From patchwork Thu Jan 2 22:08:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234707 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 3D5C4C3276C for ; Thu, 2 Jan 2020 22:33:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AA7920863 for ; Thu, 2 Jan 2020 22:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004380; bh=EDC6HNLqHPCnjOFjZoxgAGbhLmHBfVy9HFBenvThPWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HlFM6sk04veLRhKdUi8MA+oEf0+EdWoCHjnFC2p9gO2I1BdDQd0b0qWMSsgBr6Wx8 yDi9JNkL7M7P9i5kBOicaPXJSj5v3GytAqsDAmDbZdcFgdDZI22aBejUNsrB4gQarY AHiUzOmqkV5WHwNQHOBz2UgCbsD6cG9CDn+1XG1M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730203AbgABWcy (ORCPT ); Thu, 2 Jan 2020 17:32:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:39766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730472AbgABWcy (ORCPT ); Thu, 2 Jan 2020 17:32:54 -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 DEB0520863; Thu, 2 Jan 2020 22:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004373; bh=EDC6HNLqHPCnjOFjZoxgAGbhLmHBfVy9HFBenvThPWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S43E+lwxdfm3EgD/owNYwdSnJyjNq4cB22XOZHbNG7VoZ+ieBn6gVPAYR+Z3OV9GR QTyW233loCPwvpja9muXhw4AsHSF17F1yb4Q52qWqGu5oSMAyVQWV5/UZjWnY9fFUW uZeFfdUxjiuKzRb+q0amqt6J5iyo29/8fwacgkXU= 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.9 151/171] kernel: sysctl: make drop_caches write-only Date: Thu, 2 Jan 2020 23:08:02 +0100 Message-Id: <20200102220607.897153673@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 6af1ac551ea3..34449ec0689d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1398,7 +1398,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,