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 X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5BCEC2D0C6 for ; Wed, 11 Dec 2019 15:29:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCF5324658 for ; Wed, 11 Dec 2019 15:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576078184; bh=m6UjtObjWHHqzN+zVBv13rmE/XLn9eBaZMoC/IwllrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zygcrGxptc1wQrpegTHI+vrtnLbFzNGFPpNZiK3p0Ey3Lit8cqtzZNX2ZnEzVg70e 0ItD3FngY/RE50hJ21BxJE1rgl9rw8DBP5WW2aLD3iLDtmiNb7J5FxeDquaQjhBmEf ESapq/cO5hjxGGpez9UlIIUKtaqOh5F0zn5gdp7g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387951AbfLKP3n (ORCPT ); Wed, 11 Dec 2019 10:29:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:36564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387918AbfLKP3e (ORCPT ); Wed, 11 Dec 2019 10:29:34 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA9DC22B48; Wed, 11 Dec 2019 15:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576078174; bh=m6UjtObjWHHqzN+zVBv13rmE/XLn9eBaZMoC/IwllrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=01QcaYtb7gqJUJBZxZpST/F2BuevfbQWGodrEpn5yZ2whFjYnoPH0PROH/PihsG9r UO+lhTzVBYzol2xbWnlO9xkdOToYhs3LWwG2J4cgKmC+TfCYBc5ZYYBMK1QeStToux aYh40agwNoq7sMEpdM1avuGj9EGlHfZB7iAINauA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Weiner , Chris Down , Vlastimil Babka , David Hildenbrand , Michal Hocko , Alexey Dobriyan , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.14 57/58] kernel: sysctl: make drop_caches write-only Date: Wed, 11 Dec 2019 10:28:30 -0500 Message-Id: <20191211152831.23507-57-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191211152831.23507-1-sashal@kernel.org> References: <20191211152831.23507-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Weiner [ Upstream commit 204cb79ad42f015312a5bbd7012d09c93d9b46fb ] Currently, the drop_caches proc file and sysctl read back the last value written, suggesting this is somehow a stateful setting instead of a one-time command. Make it write-only, like e.g. compact_memory. While mitigating a VM problem at scale in our fleet, there was confusion about whether writing to this file will permanently switch the kernel into a non-caching mode. This influences the decision making in a tense situation, where tens of people are trying to fix tens of thousands of affected machines: Do we need a rollback strategy? What are the performance implications of operating in a non-caching state for several days? It also caused confusion when the kernel team said we may need to write the file several times to make sure it's effective ("But it already reads back 3?"). Link: http://lkml.kernel.org/r/20191031221602.9375-1-hannes@cmpxchg.org Signed-off-by: Johannes Weiner Acked-by: Chris Down Acked-by: Vlastimil Babka Acked-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index cfc2c0d1369ab..74fc3a9d19235 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1397,7 +1397,7 @@ static struct ctl_table vm_table[] = { .procname = "drop_caches", .data = &sysctl_drop_caches, .maxlen = sizeof(int), - .mode = 0644, + .mode = 0200, .proc_handler = drop_caches_sysctl_handler, .extra1 = &one, .extra2 = &four, -- 2.20.1