From: 杨逸飞 <yangyifei03@kuaishou.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: 答复: ?????!?Re: [PATCH] mm:vmscan: fix inaccurate reclaim during proactive reclaim
Date: Fri, 7 Jul 2023 22:55:55 +0000 [thread overview]
Message-ID: <585b22310286498cb125771c96ddec4c@kuaishou.com> (raw)
In-Reply-To: <20230707120931.f2ec7f5c53c5dd2788afda11@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]
Thank you for your reply. shrink_lruvec() is nested in deep loop. Reclaimer may have already reclaimed part of requested memory in one loop, but before adjust sc->nr_to_reclaim in outer loop, call shrink_lruvec() again will still follow the current sc->nr_to_reclaim to work. It will eventually lead to overreclaim. My problem case is easy to construct. Allocate lots of anonymous memory(e.g. 20G) in a memcg, then swapping by writing memory.reclaim and there is a certain probability of overreclaim.
________________________________
发件人: Andrew Morton <akpm@linux-foundation.org>
发送时间: 2023年7月8日 3:09
收件人: 杨逸飞
抄送: linux-mm@kvack.org; linux-kernel@vger.kernel.org; Johannes Weiner
主题: ?????!?Re: [PATCH] mm:vmscan: fix inaccurate reclaim during proactive reclaim
安全提示:此邮件来自公司外部。除非您确认发件人身份可信且邮件内容不含可疑信息,否则请勿回复或转发邮件、点击邮件链接或打开附件。
(cc hannes)
On Fri, 7 Jul 2023 18:32:26 +0800 Efly Young <yangyifei03@kuaishou.com> wrote:
> With commit f53af4285d77 ("mm: vmscan: fix extreme overreclaim
> and swap floods"), proactive reclaim still seems inaccurate.
>
> Our problematic scene also are almost anon pages. Request 1G
> by writing memory.reclaim will reclaim 1.7G or other values
> more than 1G by swapping.
>
> This try to fix the inaccurate reclaim problem.
It would be helpful to have some additional explanation of why you
believe the current code is incorrect?
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -6208,7 +6208,7 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
> unsigned long nr_to_scan;
> enum lru_list lru;
> unsigned long nr_reclaimed = 0;
> - unsigned long nr_to_reclaim = sc->nr_to_reclaim;
> + unsigned long nr_to_reclaim = (sc->nr_to_reclaim - sc->nr_reclaimed);
> bool proportional_reclaim;
> struct blk_plug plug;
>
[-- Attachment #2: Type: text/html, Size: 3366 bytes --]
next prev parent reply other threads:[~2023-07-07 22:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 10:32 Efly Young
2023-07-07 19:09 ` Andrew Morton
2023-07-07 22:55 ` 杨逸飞 [this message]
2023-07-11 15:28 ` Johannes Weiner
2023-07-12 7:42 ` Efly Young
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=585b22310286498cb125771c96ddec4c@kuaishou.com \
--to=yangyifei03@kuaishou.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox