Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1671022ybk; Sat, 16 May 2020 19:41:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYrmL23Z0XXABPGiQXtSuKJoKJaDHvICZgj6ZZCQ0qWrHtX+Q0YVDNFjMsDgCHbziy0Ilm X-Received: by 2002:a50:fb09:: with SMTP id d9mr8141531edq.129.1589683316358; Sat, 16 May 2020 19:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589683316; cv=none; d=google.com; s=arc-20160816; b=HnaJN3psiNZRM7HsY2YP11ogIFrernrA+xYcQQBC/UL5Lz69f7iZtNA7ixcWYVVQ7x 2u4kevKbcQ5O/xUq37nEqX2SSdHgxMnwSUCmPmu//+yIWEopyI5cHSi4LtOsCBM5irWR jlTsVz+Szrc8cz7yLZDsEDfCV5D0pkw6c96fbLGN2e+SJUg+eSbeTfAIkrLRR0IBYF9E KlJAJazHwLSLuxOjAb3mmQbW8SlaAnyqqoAv8NWCsQN9NVQW2ppIZRp0sfDLvnDMA7nB qZmC7a4HEn8Ce69mBo34maTFK8t927qgfCNYQgyhEyhOb4L+JBSuk1su/ZH6F5r+ZGQa uRsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mfO04lVnt7IYPAWled0FL/Qi9c3JqESZey18DKMQFr4=; b=ic9sJoy6fbIlu+zF8vsMPR59EO1gXpOdhSj9xz3il3hrSyvDxLQxtnpjN8diS2LQlp WkqqJ2xmGl3aoA1cNi2W+4sLTiBdz6UhobpDGfJyTGZgomDSPxS2TgrXWFDpDIoDIk+d 2gM/103zJohJX8/Ip5E8JYLWUBhEQq2hU98uADNx5RsVwNNVs7Sa7AlR8GM1a3Pbw+ww q+WLPTSGXzd0pu9meTf7icWNkpevfMjXw2Cbjqj9ucf++kAr1mYvYL/1WY+D53yv/QGw RWlSCJDOj9Y8pwfR0he6OwV2+ZmpvHM6V8OMpKt55FTfVb41zc33Bt41ICkytVrOLirk GYDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jO2sZobl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si3393862edp.75.2020.05.16.19.41.20; Sat, 16 May 2020 19:41:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jO2sZobl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726972AbgEQCiJ (ORCPT + 99 others); Sat, 16 May 2020 22:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726919AbgEQCiJ (ORCPT ); Sat, 16 May 2020 22:38:09 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90DCAC05BD09 for ; Sat, 16 May 2020 19:38:08 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x77so3066398pfc.0 for ; Sat, 16 May 2020 19:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mfO04lVnt7IYPAWled0FL/Qi9c3JqESZey18DKMQFr4=; b=jO2sZobl8FN0z739PXrPTzOWzGtM2j6pSWOxDORnMqRSl3aROaMeJk6a6FVacG6rbQ MQeJCLHQkleMPSX7/qr/CQVX27F9LMjQPFe+fPMBMf5C2fZes5q0+5V/6y4EV2j47ZFM B3ocmI7AJ3YCrMrlLYuW15XSTtcHAscFXCEMM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mfO04lVnt7IYPAWled0FL/Qi9c3JqESZey18DKMQFr4=; b=B10yM52h/+r5x1/lx7VjtS73CxPQ85WKBHB8Sbtmf0X+qjgJZb2Mplvmw2PDE5G/0d kZvhtROAu2IOcL5ZpAq+RYLJT2Sns8k2TRTzrJ0A6X29nD7P6erB1aONpkleCVskojDE pLBjaW5PkysE+s+3nOIhbqJwzJQRvgW0w6TN5jpxu8j9ea3KSbw5Bv5/bveHHvVfWJw8 mJSc5ki3hHEX+tFgTM4hC5MSP3eGu7zgwCMTbHMCPnDd9vbZHWzDqTwmV9yrZXbiyZhi u/TfxvUdSRzp3dadx3anivAdnm7EtRoY30T6CliY2QP2HAa2QmhMwhy/8aA8d7QmOT6T W4OA== X-Gm-Message-State: AOAM5326hVlghtyG1GM0E5ObW1N82znRxFb0W8WIwgGWD//qOvqCwbKV KDOGjow/FyNl+M1nyGh9ad1AAw== X-Received: by 2002:a65:4487:: with SMTP id l7mr2923380pgq.221.1589683087859; Sat, 16 May 2020 19:38:07 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m14sm696144pgn.83.2020.05.16.19.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2020 19:38:05 -0700 (PDT) Date: Sat, 16 May 2020 19:38:04 -0700 From: Kees Cook To: Xiaoming Ni Cc: mcgrof@kernel.org, yzaikin@google.com, adobriyan@gmail.com, mingo@kernel.org, peterz@infradead.org, akpm@linux-foundation.org, yamada.masahiro@socionext.com, bauerman@linux.ibm.com, gregkh@linuxfoundation.org, skhan@linuxfoundation.org, dvyukov@google.com, svens@stackframe.org, joel@joelfernandes.org, tglx@linutronix.de, Jisheng.Zhang@synaptics.com, pmladek@suse.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, wangle6@huawei.com Subject: Re: [PATCH 2/4] proc/sysctl: add shared variables -1 Message-ID: <202005161937.214F9A6@keescook> References: <1589517224-123928-1-git-send-email-nixiaoming@huawei.com> <1589517224-123928-3-git-send-email-nixiaoming@huawei.com> <202005150105.33CAEEA6C5@keescook> <88f3078b-9419-b9c6-e789-7d6e50ca2cef@huawei.com> <202005150904.743BB3E52@keescook> <202005151946.C6335E92@keescook> <2656ae51-5348-0b37-d76d-1460b8eb3f10@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2656ae51-5348-0b37-d76d-1460b8eb3f10@huawei.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 16, 2020 at 11:05:53AM +0800, Xiaoming Ni wrote: > On 2020/5/16 10:47, Kees Cook wrote: > > On Sat, May 16, 2020 at 10:32:19AM +0800, Xiaoming Ni wrote: > > > On 2020/5/16 0:05, Kees Cook wrote: > > > > On Fri, May 15, 2020 at 05:06:28PM +0800, Xiaoming Ni wrote: > > > > > On 2020/5/15 16:06, Kees Cook wrote: > > > > > > On Fri, May 15, 2020 at 12:33:42PM +0800, Xiaoming Ni wrote: > > > > > > > Add the shared variable SYSCTL_NEG_ONE to replace the variable neg_one > > > > > > > used in both sysctl_writes_strict and hung_task_warnings. > > > > > > > > > > > > > > Signed-off-by: Xiaoming Ni > > > > > > > --- > > > > > > > fs/proc/proc_sysctl.c | 2 +- > > > > > > > include/linux/sysctl.h | 1 + > > > > > > > kernel/hung_task_sysctl.c | 3 +-- > > > > > > > kernel/sysctl.c | 3 +-- > > > > > > > > > > > > How about doing this refactoring in advance of the extraction patch? > > > > > Before advance of the extraction patch, neg_one is only used in one file, > > > > > does it seem to have no value for refactoring? > > > > > > > > I guess it doesn't matter much, but I think it's easier to review in the > > > > sense that neg_one is first extracted and then later everything else is > > > > moved. > > > > > > > Later, when more features sysctl interface is moved to the code file, there > > > will be more variables that need to be extracted. > > > So should I only extract the neg_one variable here, or should I extract all > > > the variables used by multiple features? > > > > Hmm -- if you're going to do a consolidation pass, then nevermind, I > > don't think order will matter then. > > > > Thank you for the cleanup! Sorry we're giving you back-and-forth advice! > > > > -Kees > > > > Sorry, I don't fully understand. > Does this mean that there is no need to adjust the patch order or the order > of variables in sysctl_vals? > Should I extract only SYSCTL_NEG_ONE or should I extract all variables? I think either order is fine -- I though you were only doing 1 variable. If you're don't a bunch, then I don't think order is important. -- Kees Cook