zsmalloc.c (fbc90c042cd1dc7258ebfebe6d226017e5b5ac8c) zsmalloc.c (1a251f52cfdc417c84411a056bc142cbd77baef4)
1/*
2 * zsmalloc memory allocator
3 *
4 * Copyright (C) 2011 Nitin Gupta
5 * Copyright (C) 2012, 2013 Minchan Kim
6 *
7 * This code is released using a dual license strategy: BSD/GPL
8 * You can choose the license that better fits your requirements.

--- 106 unchanged lines hidden (view full) ---

115#define OBJ_INDEX_BITS (BITS_PER_LONG - _PFN_BITS)
116#define OBJ_INDEX_MASK ((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
117
118#define HUGE_BITS 1
119#define FULLNESS_BITS 4
120#define CLASS_BITS 8
121#define MAGIC_VAL_BITS 8
122
1/*
2 * zsmalloc memory allocator
3 *
4 * Copyright (C) 2011 Nitin Gupta
5 * Copyright (C) 2012, 2013 Minchan Kim
6 *
7 * This code is released using a dual license strategy: BSD/GPL
8 * You can choose the license that better fits your requirements.

--- 106 unchanged lines hidden (view full) ---

115#define OBJ_INDEX_BITS (BITS_PER_LONG - _PFN_BITS)
116#define OBJ_INDEX_MASK ((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
117
118#define HUGE_BITS 1
119#define FULLNESS_BITS 4
120#define CLASS_BITS 8
121#define MAGIC_VAL_BITS 8
122
123#define MAX(a, b) ((a) >= (b) ? (a) : (b))
124
125#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(CONFIG_ZSMALLOC_CHAIN_SIZE, UL))
126
127/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
128#define ZS_MIN_ALLOC_SIZE \
129 MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
130/* each chunk includes extra space to keep handle */
131#define ZS_MAX_ALLOC_SIZE PAGE_SIZE
132

--- 2173 unchanged lines hidden ---
123#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(CONFIG_ZSMALLOC_CHAIN_SIZE, UL))
124
125/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
126#define ZS_MIN_ALLOC_SIZE \
127 MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
128/* each chunk includes extra space to keep handle */
129#define ZS_MAX_ALLOC_SIZE PAGE_SIZE
130

--- 2173 unchanged lines hidden ---