From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4ECA7EB64DA for ; Tue, 4 Jul 2023 18:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BABCN878XVQAEQ5KlWkX9mwc3IsGxywzZddwa2mpLkA=; b=Bnd4tUdUlsQzq5 GJMqjh9O0dVeNSAboCAnY/sidp/dTBrws2VIu/L54YJ06DZFmdJj2SpbUdOskd5OBAO0ypjI/0FTe O3L1UhWyJ1GwxyZ5o9prjTZKx2pQuK4r+lkVF0E3Bcvkp13yig+YrdPf5QOx1hwd+cPFVuu4sfMcX MTSJKGMypfS14xYHVQSgSi61pFwb0Zcw+fvNkGpfvptyft2EsIObqfIxI8XgRxCrNYWBm60vruIHj 5te53CAZ95WXeq6v1RjophT2d4BdH9llNnP0dMKcLdYLTx9ZrPc8me3FpGN+OQGtKEN8kLkuiGcGK ++RSY5b9/O3zu/oV5G1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGkQc-00Dzo3-1S; Tue, 04 Jul 2023 18:07:06 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGkQX-00Dzn6-2I; Tue, 04 Jul 2023 18:07:05 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33F926131D; Tue, 4 Jul 2023 18:07:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2238BC433C7; Tue, 4 Jul 2023 18:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1688494020; bh=ax5aSQO7Q8i6scQMJDEtYLdG7HxPbixeLmpQBL1NGoo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LiSYfNW4TUnYtrQLCm6LWhvyq7sD/au+ZwfSvS7XN04La/WLKynldo0dtKtmTTBwL WunDie3WP/NVO2OTkEben6uoo40mXyy3iL4tIc0/SXP+KDsfcah/LL3k2H6Nid4f1F iT9+PXkbHIQqe5sPUk5oPnCMOivXMUqefaaSpfF8= Date: Tue, 4 Jul 2023 11:06:59 -0700 From: Andrew Morton To: Andrew Yang Cc: Alexander Viro , Christian Brauner , Matthias Brugger , AngeloGioacchino Del Regno , , , , , , , linux-mm@kvack.org Subject: Re: [PATCH] fs: drop_caches: draining pages before dropping caches Message-Id: <20230704110659.3e1de8001f9208e7278352e8@linux-foundation.org> In-Reply-To: <20230630092203.16080-1-andrew.yang@mediatek.com> References: <20230630092203.16080-1-andrew.yang@mediatek.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_110701_804292_FD809B7A X-CRM114-Status: GOOD ( 15.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 30 Jun 2023 17:22:02 +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. > > --- a/fs/drop_caches.c > +++ b/fs/drop_caches.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel