[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220613111404.5253fe6ac69f5fd145dd437c@linux-foundation.org>
Date: Mon, 13 Jun 2022 11:14:04 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: wuchi <wuchi.zero@...il.com>
Cc: alexs@...nel.org, sjhuang@...vatar.ai, sfr@...b.auug.org.au,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/genalloc: Set chunk size to real size which
gen_pool managed.
On Sun, 12 Jun 2022 18:59:37 +0800 wuchi <wuchi.zero@...il.com> wrote:
> The demand size (chunk->avail > size > round_down(chunk->avail)) will
> lead to meaningless algo calls in gen_pool_alloc_algo_owner without the
> patch, alse move the follow code:
> size = nbits << order
> out of read-side critical section.
>
Nobody has seriously worked on this code in a long time :(
Please expand more on the flaw. What are "algo calls"? Why are they
meaningless, etc? What are the runtime effects of this error?
> --- a/lib/genalloc.c
> +++ b/lib/genalloc.c
> @@ -193,6 +193,7 @@ int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt, phys_addr_t ph
> if (unlikely(chunk == NULL))
> return -ENOMEM;
>
> + size = nbits << pool->min_alloc_order;
If we're going to do this then gen_pool_add_owner() no longer needs its
`size' argument.
Powered by blists - more mailing lists