archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <>
Subject: Re: [PATCH] mm: workingset: clarify eviction order and distance calculation
Date: Thu, 11 Feb 2021 22:26:45 +0100	[thread overview]
Message-ID: <20210211212645.GB2872@localhost.localdomain> (raw)
In-Reply-To: <>

On Mon, Feb 01, 2021 at 07:06:51AM +0100, Oscar Salvador wrote:
> The premise of the refault distance is that it can be seen as a deficit
> of the inactive list space, so that if the inactive list would have had
> (R - E) more slots, the page would not have been evicted but promoted
> to the active list instead.
> However, the way the code is ordered right now set us to be off by one,
> so the real number of slots would be (R - E) + 1.
> I stumbled upon this when trying to understand the code and it puzzled me
> that the comments did not match what the code did.
> This it not an issue at all since evictions and refaults tend to happen
> in a number large enough that being off-by-one does not have any impact
> - and since the compiler and CPUs are free to rearrange the execution
> sequence anyway.
> But as Johannes says, it is better to re-arrange the code in the proper
> order since otherwise would be misleading to somebody who is actively
> reading and trying to understand the logic of the code - like it
> happened to me.
> Signed-off-by: Oscar Salvador <>
> Acked-by: Johannes Weiner <>

Hi Andrew,

is this on your radar?


Oscar Salvador

  parent reply	other threads:[~2021-02-11 21:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01  6:06 [PATCH] mm: workingset: clarify eviction order and distance calculation Oscar Salvador
2021-02-01 13:02 ` Vlastimil Babka
2021-02-11 21:26 ` Oscar Salvador [this message]
2021-02-11 21:29   ` Oscar Salvador

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:

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

  git send-email \
    --in-reply-to=20210211212645.GB2872@localhost.localdomain \ \ \ \ \ \

* 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 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).