From: Charan Teja Kalla <quic_charante@quicinc.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: <akpm@linux-foundation.org>, <minchan@kernel.org>,
<quic_pkondeti@quicinc.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>,
Suren Baghdasaryan <surenb@google.com>
Subject: Re: [PATCH] mm: madvise: fix uneven accounting of psi
Date: Thu, 1 Jun 2023 18:37:50 +0530 [thread overview]
Message-ID: <230e45e8-8cd8-3668-bbfa-a95212b4cb99@quicinc.com> (raw)
In-Reply-To: <20230531221955.GD102494@cmpxchg.org>
Thanks Johannes for taking a look at it..
On 6/1/2023 3:49 AM, Johannes Weiner wrote:
> On Wed, May 31, 2023 at 04:39:34PM +0530, Charan Teja Kalla wrote:
>> 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 that mean those pages are thrashing, but because you clear their
> workingset it isn't detected and reported via psi?
>
Seems I didn't mention the usecase clearly and let me correct it. Say we
have the Android apps A, B, C, ... H and launching of these apps goes
like below.
1) Launch app A.
2) Launch app B.
3) Launch app C. At this time, we consider the memory used by app A is
no more in active use thus proactively reclaim them where we do issue
MADV_PAGEOUT on anon regions only thus these pages goes to swap mounted
on zram and subsequently into the backing dev attached to the zram.
4) Launch app D.. Proactively reclaim the anon regions of App B into
swap and through to backing dev.
5) Now make the app A to foreground. This can read the pages from the
swap + backing dev (because of the step 3)) that belongs to app A and
also proactively reclaim anon regions of app C.
6) Launch E --> proactive reclaim of app D to zram swap + backing dev.
7) Make App B to foreground --> Read memory of app B from swap +
backingdev and as well reclaim the anon regions of app A.
8) Like wise launches of apps F, C, G, D, H, E .....
If we look at steps 5, 7,..., we are just making the apps foreground
which folios (if were marked as workingset) can contribute to PSI events
through swap_readpage(). But in reality, these are not the real
workingset folios (I think it is safe to say this), because it is the
user who decided the reclaim of these pages by issuing the MADV_PAGEOUT
which he knows that these are not going to be needed in the near future
thus reclaim them.
I think the other way to look at the problem is the user can write a
simple application where he can do MADV_PAGEOUT and read them back in a
loop. If at any point, folios user working on turns out to be a
workingset( he can just be probabilistic here), the PSI events will be
triggered though there may not be real memory pressure in the system.
> I don't rally get why silencing the thrashing is an improvement.
>
Agree that we shouldn't be really silence the thrashing. My point is we
shouldn't be considering the folios as thrashing If those were getting
reclaim by the user him self through MADV_PAGEOUT under the assumption
that __user knows they are not real working set__. Please let me know
if I am not making sense here.
>> [1]https://lore.kernel.org/all/20220214214921.419687-1-hannes@cmpxchg.org/T/#u
>>
>> Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
next prev parent reply other threads:[~2023-06-01 13:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 11:09 [PATCH] mm: madvise: fix uneven accounting of psi Charan Teja Kalla
2023-05-31 22:04 ` Andrew Morton
2023-06-01 13:18 ` Charan Teja Kalla
2023-05-31 22:19 ` Johannes Weiner
2023-06-01 13:07 ` Charan Teja Kalla [this message]
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=230e45e8-8cd8-3668-bbfa-a95212b4cb99@quicinc.com \
--to=quic_charante@quicinc.com \
--cc=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_pkondeti@quicinc.com \
--cc=surenb@google.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