Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp91434ybx; Thu, 31 Oct 2019 16:30:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwfxEEvxCTpSPcrdeviq9BlJEBk4Ml9L0UGBJwqi03X2fcSTJzgHsdiPNzaGQCNm2r4wcV X-Received: by 2002:a05:6402:19ae:: with SMTP id o14mr8147939edz.241.1572564629624; Thu, 31 Oct 2019 16:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572564629; cv=none; d=google.com; s=arc-20160816; b=al02w+6y5rRWiEhI/nIzAZXcJhFC/emBP20plVL3cDgcR6DqRAwHJqQToYJB3kobUZ CPnRMo7WWx8lFM+UFfaPdb22oVFxk1JneQqJH2qzouS0KblYbaA5qaDO1h5WvMtvn+yM EMMBfQiqEni3PZqD3NNXg/dy1+vEAqD1ou4UfpuESFCzCHkmTxlBumMkNMybqsAfNlzL 0DS4AinECHFHJkdUDlc5gn/BH9z2Q3M36E8m5RGdze8Rbi0T2EaOdeZ6Nir2BpmClXiM GzAqIg0i5uyiccPZN5Wrzh9q0xdEfS2aLfYoc7Cg+4b1m0U1g4GgRGCc3DY1LgEzon7W bh/Q== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Ukhl7NwQIMoCzKUvP9T3PEw/FgqhI3NW6JhT1q4nASQ=; b=zYaTQD6oCf0Y3MtVolORLrnwphNAd78ieYHqE8EB7O5d/KoIaxHt+FRJrreVdJjUZF FTzEbuStC2RbWLvilU/dTuye9muxNns+92/bZ4+Dnuq1VzC0ueSAVZQEnYNdXMLEpiVZ MoxpxMUZk1QeaGIVPjBEmTat6JT6CULrW4crTvPx78j3Pn0e08TEdrackgdlwbgfPvog 2vBN9AYkc8ZA+xiVXoyKIq7mqWTQ2oB/7/QFZj2qqbh/NKbKLAllL99glKkXK9p7dT2k ys2MwrkYwirs5neK0IOYWUnNUDpeJXRqpREIK8chOQDFu1nyWPHfETXuFGzz0ilgvXIC C/Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y7jGEoeq; 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 e23si5583442eda.248.2019.10.31.16.30.05; Thu, 31 Oct 2019 16:30:29 -0700 (PDT) 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=Y7jGEoeq; 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 S1727486AbfJaX20 (ORCPT + 99 others); Thu, 31 Oct 2019 19:28:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbfJaX20 (ORCPT ); Thu, 31 Oct 2019 19:28:26 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 E34AC2086D; Thu, 31 Oct 2019 23:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572564506; bh=PBIVho+NsCRnh1duj1FgKfPosLuMmKWV+Ax7lihqGaM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Y7jGEoeqAAEdG8wkoJsNM09wjH7WM7Ye0HkBYw1Zgx9Fs8zFjBRuIvcG2VtctppWL dOCPw42Jl+NFLlSxc9Irhco9vXW/+z7XAo+8yPmdzxKaMf+PXZbFrJx0A90OVcfnlq gDs9SMtGGmjxRfb6THajuRWXupQTlLp4Zux2BfeI= Date: Thu, 31 Oct 2019 16:28:25 -0700 From: Andrew Morton To: Johannes Weiner Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] kernel: sysctl: make drop_caches write-only Message-Id: <20191031162825.a545a5d4d8567368501769bd@linux-foundation.org> In-Reply-To: <20191031221602.9375-1-hannes@cmpxchg.org> References: <20191031221602.9375-1-hannes@cmpxchg.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 31 Oct 2019 18:16:02 -0400 Johannes Weiner wrote: > 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. > > ... > > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -1474,7 +1474,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, hm. Risk: some (odd) userspace code will break. Fixable by manually chmodding it back again. Reward: very little. Is the reward worth the risk?