lkml.org 
[lkml]   [2023]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 3/6] ksm: count all zero pages placed by KSM
> > diff --git a/mm/ksm.c b/mm/ksm.c
> > index 652c088f9786..72c0722be280 100644
> > --- a/mm/ksm.c
> > +++ b/mm/ksm.c
> > @@ -276,6 +276,9 @@ static unsigned int zero_checksum __read_mostly;
> > /* Whether to merge empty (zeroed) pages with actual zero pages */
> > static bool ksm_use_zero_pages __read_mostly;
> >
> > +/* The number of zero pages placed by KSM use_zero_pages */
> > +static unsigned long ksm_zero_pages_sharing;
>
> Does this count how many zero pages are currently placed or how many
> rmap items with ZERO_PAGE_FLAG are in the system?

Yes, it counts how many ksm zero pages are currently placed. and we use
rmap items with ZERO_PAGE_FLAG to record these zero page, similar to
ksm_pages_sharing and ksm_pages_shared which are recorded by the rmap_items
with STABLE_FLAG.

>
> IOW, if someone triggers MADV_DONTNEED on such a zeropage, the counter
> will not get updated, correct?

Well, the counter can get updated as someone triggers MADV_DONTNEED on such
a zeropage. You might write a simple code to test it.

\
 
 \ /
  Last update: 2023-03-27 00:16    [W:0.072 / U:1.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site