[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200824192214.GF17456@casper.infradead.org>
Date: Mon, 24 Aug 2020 20:22:14 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Miaohe Lin <linmiaohe@...wei.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/mempool: Add 'else' to split mutually exclusive case
On Mon, Aug 24, 2020 at 12:18:40PM -0700, Andrew Morton wrote:
> On Mon, 24 Aug 2020 07:53:54 -0400 Miaohe Lin <linmiaohe@...wei.com> wrote:
>
> > Add else to split mutually exclusive case and avoid some unnecessary check.
> >
> > --- a/mm/mempool.c
> > +++ b/mm/mempool.c
> > @@ -60,9 +60,8 @@ static void check_element(mempool_t *pool, void *element)
> > /* Mempools backed by slab allocator */
> > if (pool->free == mempool_free_slab || pool->free == mempool_kfree)
> > __check_element(pool, element, ksize(element));
> > -
> > /* Mempools backed by page allocator */
> > - if (pool->free == mempool_free_pages) {
> > + else if (pool->free == mempool_free_pages) {
> > int order = (int)(long)pool->pool_data;
> > void *addr = kmap_atomic((struct page *)element);
> >
>
> It doesn't seem to change code generation (compiler is smart), but I
> think it helps readability.
Not with the comments where they are
Powered by blists - more mailing lists