Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932897AbaLBCuP (ORCPT ); Mon, 1 Dec 2014 21:50:15 -0500 Received: from lgeamrelo04.lge.com ([156.147.1.127]:53092 "EHLO lgeamrelo04.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932289AbaLBCuK (ORCPT ); Mon, 1 Dec 2014 21:50:10 -0500 X-Original-SENDERIP: 10.177.220.156 X-Original-MAILFROM: minchan@kernel.org From: Minchan Kim To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Nitin Gupta , Dan Streetman , Seth Jennings , Sergey Senozhatsky , Luigi Semenzato , Jerome Marchand , juno.choi@lge.com, seungho1.park@lge.com, Minchan Kim Subject: [RFC 1/6] zsmalloc: expand size class to support sizeof(unsigned long) Date: Tue, 2 Dec 2014 11:49:42 +0900 Message-Id: <1417488587-28609-2-git-send-email-minchan@kernel.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1417488587-28609-1-git-send-email-minchan@kernel.org> References: <1417488587-28609-1-git-send-email-minchan@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For compaction of zsmalloc, we need to decouple handle and obj position binding. For that, we need another memory to keep handle and I want to reuse existing functions of zsmalloc to implement indirect layer. For that, we need to support new size class(ie, sizeof(unsigned long)) so this patch does it. Signed-off-by: Minchan Kim --- mm/zsmalloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 2021df5eb891..a806d714924c 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -100,7 +100,8 @@ * span more than 1 page which avoids complex case of mapping 2 pages simply * to restore link_free pointer values. */ -#define ZS_ALIGN 8 +#define ZS_ALIGN (sizeof(struct link_free)) +#define ZS_HANDLE_SIZE (sizeof(unsigned long)) /* * A single 'zspage' is composed of up to 2^N discontiguous 0-order (single) @@ -138,11 +139,11 @@ #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)) -#define ZS_MAX_ALLOC_SIZE PAGE_SIZE + MAX(ZS_ALIGN, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS)) +#define ZS_MAX_ALLOC_SIZE (PAGE_SIZE + ZS_HANDLE_SIZE) /* - * On systems with 4K page size, this gives 255 size classes! There is a + * On systems with 4K page size, this gives 257 size classes! There is a * trader-off here: * - Large number of size classes is potentially wasteful as free page are * spread across these classes -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/