Re: [PATCH] lib/genalloc: Set chunk size to real size which gen_pool managed.

From: Andrew Morton
Date: Tue Jun 14 2022 - 13:53:58 EST


On Tue, 14 Jun 2022 13:20:08 +0800 chi wu <wuchi.zero@xxxxxxxxx> wrote:

> > If we're going to do this then gen_pool_add_owner() no longer needs its
> > `size' argument.
> >
> >
> Sorry, What point did I misunderstand?

I mean we can now do this:

--- a/lib/genalloc.c~lib-genalloc-set-chunk-size-to-real-size-which-gen_pool-managed-fix
+++ a/lib/genalloc.c
@@ -181,13 +181,14 @@ EXPORT_SYMBOL(gen_pool_create);
*
* Returns 0 on success or a -ve errno on failure.
*/
-int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt, phys_addr_t phys,
- size_t size, int nid, void *owner)
+int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt,
+ phys_addr_t phys, int nid, void *owner)
{
struct gen_pool_chunk *chunk;
unsigned long nbits = size >> pool->min_alloc_order;
unsigned long nbytes = sizeof(struct gen_pool_chunk) +
BITS_TO_LONGS(nbits) * sizeof(long);
+ size_t size;

chunk = vzalloc_node(nbytes, nid);
if (unlikely(chunk == NULL))
_

and fix up all the callers, prototype, kerneldoc, etc. Probably as a
second followup patch.


Please take a look at that, add the additional details to the changelog
and resend?