Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3609976pxb; Mon, 21 Feb 2022 01:44:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1Ste+8V47gBcC9XLlW/WveahXEgLAjlkFfBCDeGY3l4zbBOR+AyQrAfQeudf33YO7tC7a X-Received: by 2002:a17:90b:1498:b0:1b9:bcb4:420 with SMTP id js24-20020a17090b149800b001b9bcb40420mr24757866pjb.37.1645436688668; Mon, 21 Feb 2022 01:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645436688; cv=none; d=google.com; s=arc-20160816; b=1Gs4XgecaaOyqOrL4da9K58TLH9CR/Hn/wXVBX7SuOrBlz3Z6mX1tuAQRyhQffc5Cb +puMYaxHo2LRHtwjp6l25jeXG5mTxTCZ0IocFzegUUaCvX2FKSxmxxCtIN/Bjwe+NzNq AL/9nYkiu14CKYn/oa4IrXLEB/BMrgd+mM5sAXfJ6bcQPmxgT72fVOOMjpwEhhrFFqYq j98XC8RrMBfhzG4Zy8GsyeSE2wJvOrfHH8cFPjy5a79fbEyoxWUtTZCwupXNU8ST9rAn Btkagd310KrJojU3+uiKeYl/OaLBxEVvldtOEqdqLU3eT3KV7yTfc92SO7k8/Acyfd9z 1X1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rVtuU6Hrq8wCtIw10ZxltjmyN+GjMD3/PKda00/vg6g=; b=rEhXt+ALIJBZ6Y/sJUTNX5B0lUQTQRCJqYSP/WJMIH2NZ7kk21M//e7riffHX9q7hN ODT2ZPdixkoolHGWXrHBNyvDJQL0bveXls2YbbhxoVddjh03hp057DAruUr+/iqFNaEN yUpV4YEPf8LMIscWlsghbR6i4hBMhBBBkTlfKfLtrzAQHI+aT326NQfn3/pfpLnoyr9f Jbxo3Ro537mrLmjUSv/coNg0bhF6q8LavvqHEsveQwjYOchUW1HqqpNdY4gITzy9DrUr 77QPuvWcD1QWCswCuruN9q1SlOr8/uoQKQE14GTgqoFyQ8Mp4wsWRybOhnGVbmfFq/wJ APrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QyunQTIb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a41si1109212pfx.254.2022.02.21.01.44.34; Mon, 21 Feb 2022 01:44:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QyunQTIb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242814AbiBTLkx (ORCPT + 99 others); Sun, 20 Feb 2022 06:40:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240599AbiBTLkm (ORCPT ); Sun, 20 Feb 2022 06:40:42 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8595032052; Sun, 20 Feb 2022 03:40:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rVtuU6Hrq8wCtIw10ZxltjmyN+GjMD3/PKda00/vg6g=; b=QyunQTIbhs6QyM/MNE8tIOZ8NR 8J9x7GNbtnqtEjiwN8tVwwtFQuoCUzqM472l1PRDW2oAUV3vngMml03D9suwj/LOHiOH9x7puHW0x EJdvx2+H+CG6jDZkS9WYca4c6rqDypdYOzq9g5a1MYxB9N4dDROK5iaFBrJz3RzZve2U2x+KD9RzH ezIIkD+cpqa1dd+A1vpj6a4Bxd8+XkzbaPQh37kW0OliuSDj/2wJ4M0+zNm+ECzZaMX53qu8JPMh7 J1jP5PRzIxb9WgDWq1jybO4BqplW8EHCi53BvpNeTjvmE/HXr5HKMXyiT8GFppa4U1LvZ5lt1esGP chMITAWw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLkZN-000oj8-5z; Sun, 20 Feb 2022 11:40:01 +0000 Date: Sun, 20 Feb 2022 11:40:01 +0000 From: Matthew Wilcox To: tangmeng Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, nizhen@uniontech.com, zhanglianjie@uniontech.com, nixiaoming@huawei.com Subject: Re: [PATCH 10/11] fs/drop_caches: move drop_caches sysctls to its own file Message-ID: References: <20220220060626.15885-1-tangmeng@uniontech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220220060626.15885-1-tangmeng@uniontech.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 20, 2022 at 02:06:26PM +0800, tangmeng wrote: > diff --git a/fs/drop_caches.c b/fs/drop_caches.c > @@ -75,3 +75,25 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write, > } > return 0; > } > + > +#ifdef CONFIG_SYSCTL fs/Makefile has: obj-$(CONFIG_SYSCTL) += drop_caches.o so we don't need this ifdef. > +static struct ctl_table vm_drop_caches_table[] = { > + { > + .procname = "drop_caches", > + .data = &sysctl_drop_caches, > + .maxlen = sizeof(int), > + .mode = 0200, > + .proc_handler = drop_caches_sysctl_handler, > + .extra1 = SYSCTL_ONE, > + .extra2 = SYSCTL_FOUR, > + }, > + { } > +}; Something which slightly concerns me about this sysctl splitup (which is obviously the right thing to do) is that ctl_table is quite large (64 bytes per entry) and every array is terminated with an empty one. In this example, we've gone from 64 bytes to 128 bytes. Would we be better off having a register_sysctl_one() which registers exactly one ctl_table, rather than an array? And/or a register_sysctl_array() which takes an ARRAY_SIZE() of its argument instead of looking for the NULL terminator?