All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>, Linux MM <linux-mm@kvack.org>
Subject: Re: PageLRU and the other flags
Date: Fri, 25 Sep 2020 08:44:04 -0700	[thread overview]
Message-ID: <CAHbLzkqTaMb5XH3aOD-aMid2riV37_rg-joHK-Wjt6x-xi4-zw@mail.gmail.com> (raw)
In-Reply-To: <aefb817c-433d-156e-6c9a-f8eda9e7326f@redhat.com>

On Fri, Sep 25, 2020 at 8:21 AM David Hildenbrand <david@redhat.com> wrote:
>
> On 25.09.20 17:00, Matthew Wilcox wrote:
> > I'm not quite familiar with this side of the MM yet, but it seems to
> > me like we're encoding four page states in three bits:
> >
> >  - !PageLRU (not an LRU page)
> >  - PageLRU (on the inactive list)
> >  - PageLRU + PageActive (on the active list)
> >  - PageLRU + PageUnevictable (on the unevictable list)
> >
> > Can we neaten this up into two bits?
> >
> >  - 00 (not an LRU page)
> >  - 01 (active list)
> >  - 10 (inactive list)
> >  - 11 (unevictable)
> >
> > People who free up page flags are always popular, right?
>
> They are the best :)
>
> Looking at __pagevec_lru_add_fn()
>
> SetPageLRU(page);
> smp_mb__after_atomic();
> ...
>
> if (page_evictable(page)) {
>         ...
> } else {
>         lru = LRU_UNEVICTABLE;
>         ClearPageActive(page);
>         SetPageUnevictable(page);
>         ...
> }
>
> Looks like PageActive(page) could have been relevant even without
> SetPageLRU(page);
>
> So the combo
>
> !PageLRU() + PageActive (previously was on the active list maybe?)
>
> might be valid? Or dead code? Or valid races (someone else spotting
> PageLRU() and setting it PageActive(page))?

Yes, it is valid. The page might be marked active when it is on
pagevec, then will be moved to active LRU in the next drain. Please
refer to the comment in mark_page_accessed().

> But no expert, just blindly poking around ...
>
> --
> Thanks,
>
> David / dhildenb
>
>


      reply	other threads:[~2020-09-25 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 15:00 PageLRU and the other flags Matthew Wilcox
2020-09-25 15:21 ` David Hildenbrand
2020-09-25 15:44   ` Yang Shi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHbLzkqTaMb5XH3aOD-aMid2riV37_rg-joHK-Wjt6x-xi4-zw@mail.gmail.com \
    --to=shy828301@gmail.com \
    --cc=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.