lkml.org 
[lkml]   [2018]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH v1 03/13] mm: add lock array to pgdat and batch fields to struct page
From
Date


On 02/01/2018 05:50 PM, Tim Chen wrote:
> On 01/31/2018 03:04 PM, daniel.m.jordan@oracle.com wrote:
>> This patch simply adds the array of locks and struct page fields.
>> Ignore for now where the struct page fields are: we need to find a place
>> to put them that doesn't enlarge the struct.
>>
>> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
>> ---
>> include/linux/mm_types.h | 5 +++++
>> include/linux/mmzone.h | 7 +++++++
>> mm/page_alloc.c | 3 +++
>> 3 files changed, 15 insertions(+)
>>
>> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
>> index cfd0ac4e5e0e..6e9d26f0cecf 100644
>> --- a/include/linux/mm_types.h
>> +++ b/include/linux/mm_types.h
>> @@ -190,6 +190,11 @@ struct page {
>> struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
>> };
>>
>> + struct {
>> + unsigned lru_batch;
>> + bool lru_sentinel;
>
> The above declaration adds at least 5 bytes to struct page.
> It adds a lot of extra memory overhead when multiplied
> by the number of pages in the system.

Yes, I completely agree, enlarging struct page won't cut it for the final solution.

> We can move sentinel bool to page flag, at least for 64 bit system.

There did seem to be room for one more bit the way my kernel was configured (without losing a component in page->flags), but I'd have to look again.

> And 8 bit is probably enough for lru_batch id to give a max
> lru_batch number of 256 to break the locks into 256 smaller ones.
> The max used in the patchset is 32 and that is already giving
> pretty good spread of the locking.
> It will be better if we can find some unused space in struct page
> to squeeze it in.

One idea we'd had was to store the batch id in the lower bits of the mem_cgroup pointer. CONFIG_MEMCG seems to be pretty ubiquitous these days, and it's a large enough struct (1048 bytes on one machine) to have room in the lower bits.

Another way might be to encode the previous and next lru page pointers as pfn's instead of struct list_head *'s, shrinking the footprint of struct page's lru field to allow room for the batch id.

\
 
 \ /
  Last update: 2018-02-02 05:30    [W:0.055 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site