Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11787954pjo; Thu, 2 Jan 2020 14:17:15 -0800 (PST) X-Google-Smtp-Source: APXvYqweptFR/DoJBvaqO5AcZB7mA4Cpqychpg2iXFmFymdog3Rm2UdTg3tHjU/xJPrVEU2cxR4M X-Received: by 2002:a9d:21f5:: with SMTP id s108mr77421966otb.152.1578003435309; Thu, 02 Jan 2020 14:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003435; cv=none; d=google.com; s=arc-20160816; b=ZZUYa3f2Rsrdvo69XzgPLzuC1c7CrnPhi7kupBMLDf3sq2jVMgMx6oWQpqnkyiHdPa Cz19Y4oFRXZPVIJi+tY4/uVAuaRhbgp233tJRSN1q72ZHwaTxg8GjSfiJxyYaNMos4VT cT1GPtzeTQYjJa3HUSUIUw6xGIYvV7opE3xou6UJaHbmBYJjHTeL2bQfG8dgOBlID396 84Q4dp1m2PuVlXehU4HqFBmIR1MvL4WEab42fmWPDzaZMj/HVO7mf2SSXoE7eklrMjOt WXiX56HH30kOcA8gVSONdbM1HoLkTORKXsmAre5qodmWq/XcEweuA0cRaItf6icgsPZM JZeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KurSaPQ59ezujmdD4+caFcm2IBFJRDJIyT1syxUupT4=; b=Xu2lWOIRI/wRDWmvyAsmF7RNlIKvcufglji07L4jG8/wEiNlg8lMITby9KTT97xhp0 +9Ww1Z+IE1foJY40dcLKoRd33iMCMWTMdBkmB5HPLqlmBpowUh46kBToSyfnOq+MkXjN FLDqOmGtFC41HhPyjPk62qop8T/x0Yk4MgEzk1mGbgOY9rTkCWSvlz29nVS5uiXHb2yX n9cW9ZbU6eL5dlt8PPm3BokVDlwsagV70D6jPV/HI+uSR7WrEbPSrml8NrIkZC+xe87L fe1p68XvIuMrODoiRV+f2+Lkqw5yFXOomgxbmN0Ch4HwIqCgPkz9VwGdyhf9+s7fhKTX T9nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tGtoQBe7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si27153036otb.90.2020.01.02.14.17.03; Thu, 02 Jan 2020 14:17:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tGtoQBe7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728185AbgABWQE (ORCPT + 99 others); Thu, 2 Jan 2020 17:16:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:57528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728153AbgABWP7 (ORCPT ); Thu, 2 Jan 2020 17:15:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 771EE2253D; Thu, 2 Jan 2020 22:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003358; bh=FStZvUidJVP7Ac9iFDia61wcqTXaw0GAPm9tS7Bq4d0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tGtoQBe7lmBw+C4zA4bS6nGQ3DtqKnaQ2elWCiz0sbMZe32mlyZsfPw504AD2XVws 7ogq7LEAlPIdW7U1QccZMKtaBoX+zDU4Zx0pi1Xz6Kvf5bXOjPjM7VTeeaKhLvLZ1N rLYgChfVFicNDNG9LaqWzPbX27Mr59EDn+GrXHFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Weiner , Chris Down , Vlastimil Babka , David Hildenbrand , Michal Hocko , Alexey Dobriyan , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.4 128/191] kernel: sysctl: make drop_caches write-only Date: Thu, 2 Jan 2020 23:06:50 +0100 Message-Id: <20200102215843.444023100@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 b6f2f35d0bcf..70665934d53e 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1466,7 +1466,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 = SYSCTL_ONE, .extra2 = &four, -- 2.20.1