From: Andrew Morton <akpm@linux-foundation.org>
To: Andrew Yang <andrew.yang@mediatek.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
<wsd_upstream@mediatek.com>, <casper.li@mediatek.com>,
<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
linux-mm@kvack.org
Subject: Re: [PATCH] fs: drop_caches: draining pages before dropping caches
Date: Tue, 4 Jul 2023 11:06:59 -0700 [thread overview]
Message-ID: <20230704110659.3e1de8001f9208e7278352e8@linux-foundation.org> (raw)
In-Reply-To: <20230630092203.16080-1-andrew.yang@mediatek.com>
On Fri, 30 Jun 2023 17:22:02 +0800 Andrew Yang <andrew.yang@mediatek.com> wrote:
> We expect a file page access after dropping caches should be a major
> fault, but sometimes it's still a minor fault. That's because a file
> page can't be dropped if it's in a per-cpu pagevec. Draining all pages
> from per-cpu pagevec to lru list before trying to drop caches.
>
> --- a/fs/drop_caches.c
> +++ b/fs/drop_caches.c
> @@ -10,6 +10,7 @@
> #include <linux/writeback.h>
> #include <linux/sysctl.h>
> #include <linux/gfp.h>
> +#include <linux/swap.h>
> #include "internal.h"
>
> /* A global variable is a bit ugly, but it keeps the code simple */
> @@ -59,6 +60,7 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
> static int stfu;
>
> if (sysctl_drop_caches & 1) {
> + lru_add_drain_all();
> iterate_supers(drop_pagecache_sb, NULL);
> count_vm_event(DROP_PAGECACHE);
> }
um, yes. I'm suprised that this oversight has survived 20+ years.
prev parent reply other threads:[~2023-07-04 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 9:22 [PATCH] fs: drop_caches: draining pages before dropping caches Andrew Yang
2023-07-03 10:16 ` Christian Brauner
2023-07-04 18:06 ` Andrew Morton [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=20230704110659.3e1de8001f9208e7278352e8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andrew.yang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=brauner@kernel.org \
--cc=casper.li@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=matthias.bgg@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=wsd_upstream@mediatek.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;
as well as URLs for NNTP newsgroup(s).