Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11793750pjo; Thu, 2 Jan 2020 14:23:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzZvRD5b7pTc1ztFAyUmuNzI0bn0fgPRiNk4YTe6hEDEJc8MLfXTDQ8+crqskF6HCBP7b6c X-Received: by 2002:aca:c692:: with SMTP id w140mr3319918oif.139.1578003796195; Thu, 02 Jan 2020 14:23:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003796; cv=none; d=google.com; s=arc-20160816; b=k8uMY0p7Ri5gEXcOjY3RtlWf4aQVV9vmGX2uakUUytZDwW2rVhuXQUjc1vhyW63E6+ CheENyUatl6xO/TsLjw44ipD1vqfqnXMGMGNV+EyJxgW91YWi/MZfxl0Sy35BKhP4FnJ fVhCNN/mcgMw6Kxz8aWHj63+UPcPjhN1zBZH7ewzEMxnSfCaxl7SsFRT3GSR2M8sfnUb 07iwG9pM5pNYE8BYcgb1YHV/tXTwk0aiMFf4bD6b3TkcC00odUZ/7BRM6NPfhBVYQZg8 LjWseYFDi1CNOIrh53nhyeb3zMAyRt4sjSrsOXkk1RZbQaFPCdl5fiAuV5gq2iboZACD L1uQ== 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=7l9CGzi0v59uR9vddM/uMUKKIFXgvwjYXhXbqbxOxr0=; b=jpoOYYqQwFH8QoSlA6zNt3qObT68M8Yb0+lg4DlaJWSLgLb5X3x/EXpjPo2Hg4Wicc GtGV+ufmb4NRFlU/N49DcdCC8h4i6RH974aDzFHQbGDIEM5hK/ObwBcBzDxeUNRNLbT/ UR1JhwbjDruy1/KKWeJiNwIR9lF/bMDV5EHeX/5KMARes3SDl95lcFy60WQEiuRxNIuC fcCb71RJW+sFM8jt8icmlIfiRhQTe0lPbUYc5QpvDm7uDErGP+b46SsBlAR+9HOsQsXI iVq0Ljcyc2V8DaXGAn5VIW9aeM/1LzkFQDyq0KnqPWMGH/3CDmjdBpBAAAXCUza8J+Ts 6mWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EbMovZjb; 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 i198si27930127oib.111.2020.01.02.14.23.04; Thu, 02 Jan 2020 14:23:16 -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=EbMovZjb; 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 S1727896AbgABWV3 (ORCPT + 99 others); Thu, 2 Jan 2020 17:21:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:40470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728752AbgABWVZ (ORCPT ); Thu, 2 Jan 2020 17:21:25 -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 4ED6224125; Thu, 2 Jan 2020 22:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003684; bh=HrTVBqJGvBqiSddNJgGarJ2BT+eOP7XFbllL+9PsWnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EbMovZjbhnFlu0eRV43NAnxB+oDzTBVReW5lA7A9if77Vga5/K7TrjXHM+7D8q/ky NAse5r+Jf0tyPoqcISuhRMHY9KedweZFs76oop0kkRoz4xj7HnKi3acdoQLcs9XH96 DyVirMWmsNngpOC0KqzkTP7xz2u2UUfYAcskl7oY= 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 4.19 071/114] kernel: sysctl: make drop_caches write-only Date: Thu, 2 Jan 2020 23:07:23 +0100 Message-Id: <20200102220036.228967185@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@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 f8576509c7be..4c4fd4339d33 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1411,7 +1411,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