linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [LSF/MM TOPIC] Page flags, can we free up space ?
@ 2019-01-22 20:17 Jerome Glisse
  2019-01-22 21:44 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jerome Glisse @ 2019-01-22 20:17 UTC (permalink / raw)
  To: lsf-pc; +Cc: linux-mm, linux-kernel

So lattely i have been looking at page flags and we are using 6 flags
for memory reclaim and compaction:

    PG_referenced
    PG_lru
    PG_active
    PG_workingset
    PG_reclaim
    PG_unevictable

On top of which you can add the page anonymous flag (anonymous or
share memory)
    PG_anon // does not exist, lower bit of page->mapping

And also the movable flag (which alias with KSM)
    PG_movable // does not exist, lower bit of page->mapping


So i would like to explore if there is a way to express the same amount
of information with less bits. My methodology is to exhaustively list
all the possible states (valid combination of above flags) and then to
see how we change from one state to another (what event trigger the change
like mlock(), page being referenced, ...) and under which rules (ie do we
hold the page lock, zone lock, ...).

My hope is that there might be someway to use less bits to express the
same thing. I am doing this because for my work on generic page write
protection (ie KSM for file back page) which i talk about last year and
want to talk about again ;) I will need to unalias the movable bit from
KSM bit.


Right now this is more a temptative ie i do not know if i will succeed,
in any case i can report on failure or success and discuss my finding to
get people opinions on the matter.


I think everyone interested in mm will be interested in this topic :)

Cheers,
Jérôme

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LSF/MM TOPIC] Page flags, can we free up space ?
  2019-01-22 20:17 [LSF/MM TOPIC] Page flags, can we free up space ? Jerome Glisse
@ 2019-01-22 21:44 ` Andi Kleen
  2019-01-22 21:44   ` Andi Kleen
  2019-01-22 23:52   ` Jerome Glisse
  2019-01-23  1:56 ` Mike Kravetz
  2019-01-30 11:51 ` David Hildenbrand
  2 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2019-01-22 21:44 UTC (permalink / raw)
  To: Jerome Glisse; +Cc: lsf-pc, linux-mm, linux-kernel

Jerome Glisse <jglisse@redhat.com> writes:
>
> Right now this is more a temptative ie i do not know if i will succeed,
> in any case i can report on failure or success and discuss my finding to
> get people opinions on the matter.

I would just stop putting node/zone number into the flags. These
could be all handled with a small perfect hash table, like the original
x86_64 port did, which should be quite cheap to look up.
Then there should be enough bits for everyone again.

-Andi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LSF/MM TOPIC] Page flags, can we free up space ?
  2019-01-22 21:44 ` Andi Kleen
@ 2019-01-22 21:44   ` Andi Kleen
  2019-01-22 23:52   ` Jerome Glisse
  1 sibling, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2019-01-22 21:44 UTC (permalink / raw)
  To: Jerome Glisse; +Cc: lsf-pc, linux-mm, linux-kernel

Jerome Glisse <jglisse@redhat.com> writes:
>
> Right now this is more a temptative ie i do not know if i will succeed,
> in any case i can report on failure or success and discuss my finding to
> get people opinions on the matter.

I would just stop putting node/zone number into the flags. These
could be all handled with a small perfect hash table, like the original
x86_64 port did, which should be quite cheap to look up.
Then there should be enough bits for everyone again.

-Andi


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LSF/MM TOPIC] Page flags, can we free up space ?
  2019-01-22 21:44 ` Andi Kleen
  2019-01-22 21:44   ` Andi Kleen
@ 2019-01-22 23:52   ` Jerome Glisse
  1 sibling, 0 replies; 6+ messages in thread
From: Jerome Glisse @ 2019-01-22 23:52 UTC (permalink / raw)
  To: Andi Kleen; +Cc: lsf-pc, linux-mm, linux-kernel

On Tue, Jan 22, 2019 at 01:44:15PM -0800, Andi Kleen wrote:
> Jerome Glisse <jglisse@redhat.com> writes:
> >
> > Right now this is more a temptative ie i do not know if i will succeed,
> > in any case i can report on failure or success and discuss my finding to
> > get people opinions on the matter.
> 
> I would just stop putting node/zone number into the flags. These
> could be all handled with a small perfect hash table, like the original
> x86_64 port did, which should be quite cheap to look up.
> Then there should be enough bits for everyone again.

Definitly something i will look into, i was scare to remove those.

Cheers,
Jérôme

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LSF/MM TOPIC] Page flags, can we free up space ?
  2019-01-22 20:17 [LSF/MM TOPIC] Page flags, can we free up space ? Jerome Glisse
  2019-01-22 21:44 ` Andi Kleen
@ 2019-01-23  1:56 ` Mike Kravetz
  2019-01-30 11:51 ` David Hildenbrand
  2 siblings, 0 replies; 6+ messages in thread
From: Mike Kravetz @ 2019-01-23  1:56 UTC (permalink / raw)
  To: Jerome Glisse, lsf-pc; +Cc: linux-mm, linux-kernel, Matthew Wilcox

On 1/22/19 12:17 PM, Jerome Glisse wrote:
> So lattely i have been looking at page flags and we are using 6 flags
> for memory reclaim and compaction:
> 
>     PG_referenced
>     PG_lru
>     PG_active
>     PG_workingset
>     PG_reclaim
>     PG_unevictable
> 
> On top of which you can add the page anonymous flag (anonymous or
> share memory)
>     PG_anon // does not exist, lower bit of page->mapping
> 
> And also the movable flag (which alias with KSM)
>     PG_movable // does not exist, lower bit of page->mapping
> 
> 
> So i would like to explore if there is a way to express the same amount
> of information with less bits. My methodology is to exhaustively list
> all the possible states (valid combination of above flags) and then to
> see how we change from one state to another (what event trigger the change
> like mlock(), page being referenced, ...) and under which rules (ie do we
> hold the page lock, zone lock, ...).
> 
> My hope is that there might be someway to use less bits to express the
> same thing. I am doing this because for my work on generic page write
> protection (ie KSM for file back page) which i talk about last year and
> want to talk about again ;) I will need to unalias the movable bit from
> KSM bit.
> 
> 
> Right now this is more a temptative ie i do not know if i will succeed,
> in any case i can report on failure or success and discuss my finding to
> get people opinions on the matter.
> 
> 
> I think everyone interested in mm will be interested in this topic :)

Explicitly adding Matthew on Cc as I am pretty sure he has been working
in this area.

-- 
Mike Kravetz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LSF/MM TOPIC] Page flags, can we free up space ?
  2019-01-22 20:17 [LSF/MM TOPIC] Page flags, can we free up space ? Jerome Glisse
  2019-01-22 21:44 ` Andi Kleen
  2019-01-23  1:56 ` Mike Kravetz
@ 2019-01-30 11:51 ` David Hildenbrand
  2 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2019-01-30 11:51 UTC (permalink / raw)
  To: Jerome Glisse, lsf-pc; +Cc: linux-mm, linux-kernel, Michal Hocko

On 22.01.19 21:17, Jerome Glisse wrote:
> So lattely i have been looking at page flags and we are using 6 flags
> for memory reclaim and compaction:
> 
>     PG_referenced
>     PG_lru
>     PG_active
>     PG_workingset
>     PG_reclaim
>     PG_unevictable
> 
> On top of which you can add the page anonymous flag (anonymous or
> share memory)
>     PG_anon // does not exist, lower bit of page->mapping
> 
> And also the movable flag (which alias with KSM)
>     PG_movable // does not exist, lower bit of page->mapping


I would really like to see an easier way to spot if a page is movable.

__PageMovable() can produce way to many false positives.

movable will usually not be paired with other flags you mentioned as of now.

If many of these flags are not used in combination, we could merge some
of the flags into a number field. Valid combinations would get a number
assigned.

To keep it simple, only flags that are completely exclusive might be a
candidate. But not sure if we really have many of these.

> 
> 
> So i would like to explore if there is a way to express the same amount
> of information with less bits. My methodology is to exhaustively list
> all the possible states (valid combination of above flags) and then to
> see how we change from one state to another (what event trigger the change
> like mlock(), page being referenced, ...) and under which rules (ie do we
> hold the page lock, zone lock, ...).
> 
> My hope is that there might be someway to use less bits to express the
> same thing. I am doing this because for my work on generic page write
> protection (ie KSM for file back page) which i talk about last year and
> want to talk about again ;) I will need to unalias the movable bit from
> KSM bit.
> 
> 
> Right now this is more a temptative ie i do not know if i will succeed,
> in any case i can report on failure or success and discuss my finding to
> get people opinions on the matter.
> 
> 
> I think everyone interested in mm will be interested in this topic :)
> 
> Cheers,
> Jérôme
> 


-- 

Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-30 11:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 20:17 [LSF/MM TOPIC] Page flags, can we free up space ? Jerome Glisse
2019-01-22 21:44 ` Andi Kleen
2019-01-22 21:44   ` Andi Kleen
2019-01-22 23:52   ` Jerome Glisse
2019-01-23  1:56 ` Mike Kravetz
2019-01-30 11:51 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).