From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753269AbcHPHZh (ORCPT ); Tue, 16 Aug 2016 03:25:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:50736 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752910AbcHPHZg (ORCPT ); Tue, 16 Aug 2016 03:25:36 -0400 Subject: Re: [PATCH v2 5/6] mm/page_ext: support extra space allocation by page_ext user To: js1304@gmail.com, Andrew Morton References: <1471315879-32294-1-git-send-email-iamjoonsoo.kim@lge.com> <1471315879-32294-6-git-send-email-iamjoonsoo.kim@lge.com> Cc: Minchan Kim , Michal Hocko , Sergey Senozhatsky , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Joonsoo Kim From: Vlastimil Babka Message-ID: Date: Tue, 16 Aug 2016 09:25:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <1471315879-32294-6-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/16/2016 04:51 AM, js1304@gmail.com wrote: > From: Joonsoo Kim > > Until now, if some page_ext users want to use it's own field on page_ext, > it should be defined in struct page_ext by hard-coding. It has a problem > that wastes memory in following situation. > > struct page_ext { > #ifdef CONFIG_A > int a; > #endif > #ifdef CONFIG_B > int b; > #endif > }; > > Assume that kernel is built with both CONFIG_A and CONFIG_B. > Even if we enable feature A and doesn't enable feature B at runtime, > each entry of struct page_ext takes two int rather than one int. > It's undesirable result so this patch tries to fix it. > > To solve above problem, this patch implements to support extra space > allocation at runtime. When need() callback returns true, it's extra > memory requirement is summed to entry size of page_ext. Also, offset > for each user's extra memory space is returned. With this offset, > user can use this extra space and there is no need to define needed > field on page_ext by hard-coding. > > This patch only implements an infrastructure. Following patch will use it > for page_owner which is only user having it's own fields on page_ext. > > Signed-off-by: Joonsoo Kim Acked-by: Vlastimil Babka