Re: [PATCHv6 1/8] zsmalloc: add to mm/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 21 Feb 2013 16:21:37 -0600
Seth Jennings <sjenning@xxxxxxxxxxxxxxxxxx> wrote:

> On 02/21/2013 02:36 PM, Cody P Schafer wrote:
> > On Wed, Feb 20, 2013 at 04:04:41PM -0600, Seth Jennings wrote:
> >> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> >> +#define MAX(a, b) ((a) >= (b) ? (a) : (b))
> >> +/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
> >> +#define ZS_MIN_ALLOC_SIZE \
> >> +	MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
> > 
> > Could you use the max(a,b) defined in include/linux/kernel.h?
> > 
> 
> Andrew Morton made the same point.  We can't use max() or max_t()
> because the value of ZS_MIN_ALLOC_SIZE is used to derive the value of
> ZS_SIZE_CLASSES which is used to size an array in struct zs_pool.
> 
> So the expression must be completely evaluated to a number by the
> precompiler.

Well yes, but the kernel doesn't need eight(!) separate
implementations of

#define MAX(a, b) ((a) > (b) ? (a) : (b))
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux