linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Andrew Yang <andrew.yang@mediatek.com>, linux-mm@kvack.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	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,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] fs: drop_caches: draining pages before dropping caches
Date: Mon, 3 Jul 2023 12:16:57 +0200	[thread overview]
Message-ID: <20230703-freifahrt-dachwohnung-49d858588e88@brauner> (raw)
In-Reply-To: <20230630092203.16080-1-andrew.yang@mediatek.com>

Really more suitable for -mm to review.

On Fri, Jun 30, 2023 at 05:22:02PM +0800, Andrew Yang 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.
> 
> Signed-off-by: Andrew Yang <andrew.yang@mediatek.com>
> ---
>  fs/drop_caches.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/drop_caches.c b/fs/drop_caches.c
> index e619c31b6bd9..b9575957a7c2 100644
> --- 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);
>  		}
> -- 
> 2.18.0
> 


       reply	other threads:[~2023-07-03 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230630092203.16080-1-andrew.yang@mediatek.com>
2023-07-03 10:16 ` Christian Brauner [this message]
2023-07-04 18:06 ` Andrew Morton

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=20230703-freifahrt-dachwohnung-49d858588e88@brauner \
    --to=brauner@kernel.org \
    --cc=andrew.yang@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --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=willy@infradead.org \
    --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