Re: [RFC PATCH 3/3] mm/zsmalloc: change ZS_MAX_PAGES_PER_ZSPAGE

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

 



On (02/19/16 14:38), Sergey Senozhatsky wrote:
[..]
> #define OBJ_ALLOCATED_TAG 1
> #define OBJ_TAG_BITS 1
> #define OBJ_INDEX_BITS	(BITS_PER_LONG - _PFN_BITS - OBJ_TAG_BITS)
> #define OBJ_INDEX_MASK	((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
> 
> #define ZS_MIN_ALLOC_SIZE \
> 	MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
[..]

> -- on 32 bit system, PAGE_SHIFT 12
> 
> ZS_MAX_PAGES_PER_ZSPAGE 1 << 4						16
> OBJ_INDEX_BITS (32 - (32 - 12) - 1)					11
> OBJ_INDEX_MASK ((1 << (32 - (32 - 12) - 1)) - 1)			2047
> ZS_MIN_ALLOC_SIZE MAX(32, ((1 << 4) << 12 >> (32 - (32 - 12) - 1)))	32
> 
> -- on 64 bit system, PAGE_SHIFT 12
> 
> ZS_MAX_PAGES_PER_ZSPAGE 1 << 4						16
> OBJ_INDEX_BITS (64 - (64 - 12) - 1)					11
> OBJ_INDEX_MASK ((1 << (64 - (64 - 12) - 1)) - 1)			2047
> ZS_MIN_ALLOC_SIZE MAX(32, ((1 << 4) << 12 >> (64 - (64 - 12) - 1)))	32

even if it's missing  "HANDLE_PIN_BIT 0", it's still OBJ_INDEX_BITS 10,
2<<10 should be enough to keep 32 bytes class around.


> -- on 64 bit system, PAGE_SHIFT 14
> 
> ZS_MAX_PAGES_PER_ZSPAGE 1 << 4						16
> OBJ_INDEX_BITS (64 - (64 - 14) - 1)					13
> OBJ_INDEX_MASK ((1 << (64 - (64 - 14) - 1)) - 1)			8191
> ZS_MIN_ALLOC_SIZE MAX(32, ((1 << 4) << 14 >> (64 - (64 - 14) - 1)))	32

OBJ_INDEX_BITS 2<<12 still looks to be good enough.

	-ss

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]