mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Charan Teja Kalla <quic_charante@quicinc.com>
Cc: <hannes@cmpxchg.org>, <minchan@kernel.org>,
	<quic_pkondeti@quicinc.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: madvise: fix uneven accounting of psi
Date: Wed, 31 May 2023 15:04:49 -0700	[thread overview]
Message-ID: <20230531150449.56311ca2ea6184b413517672@linux-foundation.org> (raw)
In-Reply-To: <1685531374-6091-1-git-send-email-quic_charante@quicinc.com>

On Wed, 31 May 2023 16:39:34 +0530 Charan Teja Kalla <quic_charante@quicinc.com> wrote:

> A folio turns into a Workingset during:
> 1) shrink_active_list() placing the folio from active to inactive list.
> 2) When a workingset transition is happening during the folio refault.
> 
> And when Workingset is set on a folio, PSI for memory can be accounted
> during a) That folio is being reclaimed and b) Refault of that folio.
> 
> There exists clients who can do the proactive reclaim using the system
> calls like madvise(), whose folios can be safely treated as inactive
> folios assuming the client knows that these folios are not needed in the
> near future thus wanted to reclaim them. For such folios psi is not
> accounted uniformly:
> a) A folio started at inactive and moved to active as part of accesses.
> Workingset is absent on the folio thus madvise(MADV_PAGEOUT) don't
> account such folios for PSI.
> 
> b) When the same folio transition from inactive->active and then to
> inactive through shrink_active_list(). Workingset is set on the folio
> thus madvise(MADV_PAGEOUT) account such folios for PSI.
> 
> c) When the same folio is part of active list directly as a result of
> folio refault and this was a workingset folio prior to eviction.
> Workingset is set on the folio thus madvise(MADV_PAGEOUT) account such
> folios for PSI.
> 
> As said about the MADV_PAGEOUT on a folio is accounted in b) and c) but
> not in a) which is inconsistent. Remove this inconsistency by always not
> considering the PSI for folios that are getting reclaimed through
> madvise(MADV_PAGEOUT) by clearing the Workingset on a folio. This
> consistency of clearing the workingset was chosen under the assumption
> that client knows these folios are not in active use thus reclaiming
> them hence not eligible as workingset folios. Probably it is the same
> reason why workingset is not set on a folio through MADV_COLD but during
> the shrink_active_list() though both the actions make the folio put onto
> the inactive list.
> 
> This patch is tested on Android, Snapdragon SoC with 8Gb RAM, 4GB swap
> mounted on zram which has 2GB of backingdev. The test case involved
> launching some memory hungry apps in an order and do the proactive
> reclaim for the app that went to background using madvise(MADV_PAGEOUT).
> We are seeing ~40% less total values of psi mem some and full when this
> patch is combined with [1].

Does this accounting inaccuracy have any perceptible runtime effects?



  reply	other threads:[~2023-05-31 22:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 11:09 Charan Teja Kalla
2023-05-31 22:04 ` Andrew Morton [this message]
2023-06-01 13:18   ` Charan Teja Kalla
2023-05-31 22:19 ` Johannes Weiner
2023-06-01 13:07   ` Charan Teja Kalla
2023-06-05 18:00     ` Johannes Weiner
2023-06-06 14:53       ` Charan Teja Kalla
2023-06-06 19:48         ` Suren Baghdasaryan
2023-06-09 12:42           ` Charan Teja Kalla
2023-06-09 23:13             ` Suren Baghdasaryan
2023-06-12 13:40               ` Johannes Weiner
2023-06-26 14:31               ` Charan Teja Kalla
2023-06-27 22:50                 ` Suren Baghdasaryan
2023-06-13  3:13             ` Pavan Kondeti

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=20230531150449.56311ca2ea6184b413517672@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=quic_charante@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®