Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2706735imc; Tue, 12 Mar 2019 22:21:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSzbs6maLBnlZLNxQcIDEshxPuSvAx5hbK1JvjMONlIMvmw3zybiMyDF5RM6yqV7Xnd8KM X-Received: by 2002:a17:902:2bc7:: with SMTP id l65mr43940299plb.79.1552454513698; Tue, 12 Mar 2019 22:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552454513; cv=none; d=google.com; s=arc-20160816; b=MfnFlqZw518BSZwaZc6vfUl3qD6mxvy3aCKWxovlBn5zzMdzkvTKQM/49V9cJyeOL5 +IHyeihEsZS8haQjpL6AN57ToJsBr5Bg1TwCeT7/QcH/Yd5gp3TyrkPo9+H5a+16CSM+ E5fD3J4s2EUku++MFIJkDOr/UKTrFS9Fxr/+QpBW0grzKTdOJth3kHcYyT3pBzQOKvBA mC2/NYix8T0D/8Jd5bu/E2XRJ88vLSXh2XYLugam/rS7eQNj/4xDiEgGgPLb63GPO+k7 3Qh3GSRojfy+bVgMCj7UxUCAHVxvIahdAFUuNUJa47F8cMuEMFfEmOwWZDVJkNW9vKir pdgQ== 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:date:subject:cc:to:from :dkim-signature; bh=acU2gA0XupWBWu0QZQ+K9+WO5Dqp8Z/Fo1Pi8Ye78KI=; b=i5Lcrav2Wz352+jGixLrm6DW1elLd4P6MC6/WMpKFUVlPgAdqiKvvyEaireco95wAF E7qoFaFIqxF2pAYPTJtA/NTJ77g8/WgPwyCvtsYswGjY8l8byJCzw4rswOPlUt5SqWSL PSTIP1e/+8VXAlZTa+LvMSqDfh6sl6HE9H+TEFP6iDnIBFbPwgKLns/Icemxq38oDBf9 dzJFyzgkwSNwDkm0pl+B8xshs4fSEU8RHWupeYHgHok2eVET+3Z8CIBFIG1vEFCCGaq8 1OPWPJwHur3zKbXCNPeIGdnEJm3QMXrtCZ2Un3KLh7neNDP9qWUEHJySVgMtIalT8fCR YRWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=GN9yesFe; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si8914768pgt.357.2019.03.12.22.21.38; Tue, 12 Mar 2019 22:21:53 -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=@messagingengine.com header.s=fm2 header.b=GN9yesFe; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726698AbfCMFVN (ORCPT + 99 others); Wed, 13 Mar 2019 01:21:13 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:46155 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbfCMFVK (ORCPT ); Wed, 13 Mar 2019 01:21:10 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id A62DC38B1; Wed, 13 Mar 2019 01:21:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 13 Mar 2019 01:21:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=acU2gA0XupWBWu0QZQ+K9+WO5Dqp8Z/Fo1Pi8Ye78KI=; b=GN9yesFe fo3KT4XAJDo714mB4gMydBPdMeMcnDRvhbZd+Ds8bNI2CGiKHRAoXJ7qpAFIl0wt wQhyVSgBu3pX1OUcdyYEhiWu0izqCbGg6ir2mVHVycMsrHFVyBU8C164PbRHmtxg AVCaisFmX5hUQQK+n+uQJ6scViCswM4tfjP3sZFO1m3fWxYLrpN+LeQLoLYK/Q9I Jttj8HFw54NR6+Ry+RcSxZ+Yl5+a332qgVj5cqPU+VFhrSgZkXx4+2hpFbfEXcYq DNlh0hsT2LzY5y7oL6AA8XuMejIP21MXq6X8GllKS4On7arir1leNxSISDUcF0a9 m4nvuUJJivoAaw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrgeelgdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepfdfvohgsihhn ucevrdcujfgrrhguihhnghdfuceothhosghinheskhgvrhhnvghlrdhorhhgqeenucfkph epuddvgedrudeiledrvdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehtohgs ihhnsehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from eros.localdomain (124-169-23-184.dyn.iinet.net.au [124.169.23.184]) by mail.messagingengine.com (Postfix) with ESMTPA id CB509E4693; Wed, 13 Mar 2019 01:21:04 -0400 (EDT) From: "Tobin C. Harding" To: Andrew Morton Cc: "Tobin C. Harding" , Roman Gushchin , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] slub: Add comments to endif pre-processor macros Date: Wed, 13 Mar 2019 16:20:26 +1100 Message-Id: <20190313052030.13392-2-tobin@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190313052030.13392-1-tobin@kernel.org> References: <20190313052030.13392-1-tobin@kernel.org> 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 SLUB allocator makes heavy use of ifdef/endif pre-processor macros. The pairing of these statements is at times hard to follow e.g. if the pair are further than a screen apart or if there are nested pairs. We can reduce cognitive load by adding a comment to the endif statement of form #ifdef CONFIG_FOO ... #endif /* CONFIG_FOO */ Add comments to endif pre-processor macros if ifdef/endif pair is not immediately apparent. Reviewed-by: Roman Gushchin Signed-off-by: Tobin C. Harding --- mm/slub.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 1b08fbcb7e61..b282e22885cd 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1951,7 +1951,7 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags, } } } while (read_mems_allowed_retry(cpuset_mems_cookie)); -#endif +#endif /* CONFIG_NUMA */ return NULL; } @@ -2249,7 +2249,7 @@ static void unfreeze_partials(struct kmem_cache *s, discard_slab(s, page); stat(s, FREE_SLAB); } -#endif +#endif /* CONFIG_SLUB_CPU_PARTIAL */ } /* @@ -2308,7 +2308,7 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) local_irq_restore(flags); } preempt_enable(); -#endif +#endif /* CONFIG_SLUB_CPU_PARTIAL */ } static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) @@ -2813,7 +2813,7 @@ void *kmem_cache_alloc_node_trace(struct kmem_cache *s, } EXPORT_SYMBOL(kmem_cache_alloc_node_trace); #endif -#endif +#endif /* CONFIG_NUMA */ /* * Slow path handling. This may still be called frequently since objects @@ -3845,7 +3845,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node) return ret; } EXPORT_SYMBOL(__kmalloc_node); -#endif +#endif /* CONFIG_NUMA */ #ifdef CONFIG_HARDENED_USERCOPY /* @@ -4063,7 +4063,7 @@ void __kmemcg_cache_deactivate(struct kmem_cache *s) */ slab_deactivate_memcg_cache_rcu_sched(s, kmemcg_cache_deact_after_rcu); } -#endif +#endif /* CONFIG_MEMCG */ static int slab_mem_going_offline_callback(void *arg) { @@ -4696,7 +4696,7 @@ static int list_locations(struct kmem_cache *s, char *buf, len += sprintf(buf, "No data\n"); return len; } -#endif +#endif /* CONFIG_SLUB_DEBUG */ #ifdef SLUB_RESILIENCY_TEST static void __init resiliency_test(void) @@ -4756,7 +4756,7 @@ static void __init resiliency_test(void) #ifdef CONFIG_SYSFS static void resiliency_test(void) {}; #endif -#endif +#endif /* SLUB_RESILIENCY_TEST */ #ifdef CONFIG_SYSFS enum slab_stat_type { @@ -5413,7 +5413,7 @@ STAT_ATTR(CPU_PARTIAL_ALLOC, cpu_partial_alloc); STAT_ATTR(CPU_PARTIAL_FREE, cpu_partial_free); STAT_ATTR(CPU_PARTIAL_NODE, cpu_partial_node); STAT_ATTR(CPU_PARTIAL_DRAIN, cpu_partial_drain); -#endif +#endif /* CONFIG_SLUB_STATS */ static struct attribute *slab_attrs[] = { &slab_size_attr.attr, @@ -5614,7 +5614,7 @@ static void memcg_propagate_slab_attrs(struct kmem_cache *s) if (buffer) free_page((unsigned long)buffer); -#endif +#endif /* CONFIG_MEMCG */ } static void kmem_cache_release(struct kobject *k) -- 2.21.0