Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp62090ybx; Thu, 31 Oct 2019 15:59:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK5jrtAWvduXuUKUPA/MLa49dR/Yjq2OnWQA2M5wgfA2/3lJcNy5f288hD9+riYm5DuOUM X-Received: by 2002:a50:9930:: with SMTP id k45mr9180810edb.134.1572562756748; Thu, 31 Oct 2019 15:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572562756; cv=none; d=google.com; s=arc-20160816; b=BckDelkvvW+oQ5xfSD9z3dNKlpNtWxS29lr7LvJim7CQvy7Y+fRv3JJJdUoE0Xt9cD xYMfp1dqHCZFV2ZjzrSeak8weBnxuZGNMLD76Vvlc/SriCcPxRnUOYjDRR4cSRDFolSO N/hy9gKVhRjmmLTJ0wQ2ZxUdvmBcatj/HuVS9BkGGWUh/P6OCzF4qYIDHvrXnPdicJHs qyyiuz6MdfhVoKzXVu03ZmIU2rwGWi+emQW45R7UASe0kKew/NaA4O/0shy797LxTUkY pxTZRJ89nE5g+KsbvGfLnGvJqrIBTORebM1rUztrPQSXPyg3TJSTaIemjYB5oHOqR0vT Xx0Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=rvzKkNDnFw8WgEsEEsv1HzkDI4bs5dlMd1q1SJlSRv8=; b=WtM9XA6ItqOVAT3ehJErkWfSBDLshrqSDglwMlkXqGlye0upqDz/9V6yR3J0uvdQe8 EM9pDU+V6aBCcgE/kM+T93ymn1WFnwTFIr5ctyKr9BjiT60bmMOf61pM72nVvKA8vIAL IJ0qGO3/ltpr2wXSKXSLcknw64XXErumZOOXQKtJs7JZNp9x9gEn8wCfT0K4+8HW17RY O423ZMl5JRpoMby16Ehf2zHffW8vIY9/XDYd0/0r8pUx1+S2w+sihagF+bY+OH/WhDpa FmhZn4h/rPOaev/lxMv/Ea31ggHZlSRwT9gLfgOo0z1gmpEFpORFzev30/F58OFemjpG UHnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=IDDK+UpM; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hk1si4440292ejb.408.2019.10.31.15.58.54; Thu, 31 Oct 2019 15:59:16 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=IDDK+UpM; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729027AbfJaWQF (ORCPT + 99 others); Thu, 31 Oct 2019 18:16:05 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:33926 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726602AbfJaWQF (ORCPT ); Thu, 31 Oct 2019 18:16:05 -0400 Received: by mail-qt1-f196.google.com with SMTP id e14so10689539qto.1 for ; Thu, 31 Oct 2019 15:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rvzKkNDnFw8WgEsEEsv1HzkDI4bs5dlMd1q1SJlSRv8=; b=IDDK+UpMUsRWxn79to0tss/Udaa2EnOB3HfpzeuN+sK1qCRI5FyV/QzNzsS7OOr9+w uexitjcUSu0EToVQtruGvGYqrTR3Zb8B6WiuY/oo5A4TeAEwktQqtNARmn+yIH0G91km oY7J0NjnqjXoh0wGiX0SOOS0uzfMuCztFNMqXuPNw1JhqDcS/b2ufzSuUMZP4GZIf6ot QwGxWRb5o9XIekockwk6hdk/UxsQw18QyS37rDT3xWJSGLm5WH8hCVqEkqpW5L24+P5i wDzYtit4hSwUHd07pXrCCjkerLSZbVegytzILb2WJM48locQzG/1EwyYMDqL9T/E7o8W c1RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rvzKkNDnFw8WgEsEEsv1HzkDI4bs5dlMd1q1SJlSRv8=; b=JXpKKZSSNdH2XtQgzH0Y7JQUEMy4Tk3A6l2wakmFllG1HuQnfD5JSRmK6OaUWHETrF rih/3r16AOLhm0HzEYx1Xt9P1NJSbwcDehvo39E0FlT3rVANzuU5lOYxgHSCZljxQy2N Vuq9pOfLe9GYvaMweVgW/LCeFeGaf/8QSNYgxM50NrxeVM4Tjmx8Jj1nh1b2hb1BN+01 ye0rLqinJjLvtPel2vNNgCZEaFuBwRuuOG29KWCkSgdTBaVct5Mpe/HNeHGfz2nHeDzn fZLOrvTNpniM2RrDzDAp73/+dKHp/+ZUdkXCCZhkiZ+wNpY7WcNczXLDYyzcAVqBTh+V CgQg== X-Gm-Message-State: APjAAAUPjItHR6hGwfZWr+0is0NwvtDzPlKkGY/zZf28IIwWE8vgKosh 6EE/X0h3ep6oYUUrG02aGngs8zoI2Sc= X-Received: by 2002:ac8:866:: with SMTP id x35mr7645846qth.90.1572560164030; Thu, 31 Oct 2019 15:16:04 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::c357]) by smtp.gmail.com with ESMTPSA id x12sm2151101qkh.96.2019.10.31.15.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 15:16:03 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] kernel: sysctl: make drop_caches write-only Date: Thu, 31 Oct 2019 18:16:02 -0400 Message-Id: <20191031221602.9375-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Johannes Weiner --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 31ece1120aa4..50373984a5e2 100644 --- 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, -- 2.23.0