[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bf7c2a6b801a4430bf842fc20e826db6@AcuMS.aculab.com>
Date: Mon, 12 Nov 2018 09:55:23 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Vlastimil Babka' <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>
CC: 'Bart Van Assche' <bvanassche@....org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mel Gorman <mgorman@...hsingularity.net>,
Christoph Lameter <cl@...ux.com>, Roman Gushchin <guro@...com>,
"Darryl T. Agostinelli" <dagostinelli@...il.com>
Subject: RE: [PATCH] slab.h: Avoid using & for logical and of booleans
From: Vlastimil Babka [mailto:vbabka@...e.cz]
> Sent: 09 November 2018 19:16
...
> This? Not terribly elegant, but I don't see a nicer way right now...
Maybe just have two copies of the function body?
static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags)
{
#ifndef CONFIG_ZONE_DMA
return flags & __GFP_RECLAIMABLE ? KMALLOC_RECLAIM : KMALLOC_NORMAL;
#else
if (likely((flags & (__GFP_DMA | __GFP_RECLAIMABLE)) == 0))
return KMALLOC_NORMAL;
return flags & __GFP_DMA ? KMALLOC_DMA : KMALLOC_RECLAIM;
#endif
}
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists