Received: by 10.192.165.148 with SMTP id m20csp3843615imm; Mon, 7 May 2018 21:17:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpR2wV5mgDGpOrugaXy/snIbVMIH2X1GP0Av5RjDx3x6Lgc0VcVwbmPUJ/o51tKli+B2eb9 X-Received: by 2002:a65:62c2:: with SMTP id m2-v6mr32024285pgv.164.1525753028890; Mon, 07 May 2018 21:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525753028; cv=none; d=google.com; s=arc-20160816; b=K4r8fHhovI/yjKm3ntKafRLVHzpr33UonFk5tT19j1hv2Roy+OrciUwXbO7HkqPVzt 0H9X8RMIWoVorO2ixLhcKS5JC4zAq6Pw3YGPfTpLw+23VmUBHs5ZtVQ5U85c/oPTIkCd eH+N9enTb5Oz68d1bvSczAVAM4146YXmA8vcdnt8qxcUdRuL0Ij/goyzkWf5WrSfl77R ZbnW1XA1rgt95NnPeeOhIoywgC3WredIUo9qAs+WbN4t7vhRshBIQ80Gi6YWLss2mDQP UNCw44bU3Q6b792M+0eWszDkg5OQOf+UOqSiCfvwVkRbaQtQJK5s+atHwJ3t8R9oK36e iaww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:arc-authentication-results; bh=/AAhwSEYsaC8NkmBJMeZcvvcnIYCRvjupNs4QbtElTs=; b=TOO5lNB2DJs2h1LPLS+3VOAX7lMK+HIYhSRDttSnhsdKsuSGLC+JZRVQFGhCPS5b+V 4rA3mJYd+rUq83rnK3/VSPBYam7SGsyIQw+gOSOJTl/EK1bVYTAhavdLhEAl5LEUaUY0 tqtmOM9fUI8ffg+tmgExRCp5nqz5RbUUkh1ZyD61hICukjuI02OHBfv1J1F9a5Ke2urN XPTVxGA9kLQP4M6V7poX7uFTC5TK8+AoIvkTlz6WPZvjb7eU1zocLhB5qtpuyrkBoPkp qsYcUXlIMMj5IKiMxg5O95lYyy62OxR4cksee6VkobdtNJZAXUGCseV0EE1Pt3EsLKoj /CMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=odAFrbq0; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si18709365pgc.166.2018.05.07.21.16.51; Mon, 07 May 2018 21:17:08 -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=fail header.i=@gmail.com header.s=20161025 header.b=odAFrbq0; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751634AbeEHEPT (ORCPT + 99 others); Tue, 8 May 2018 00:15:19 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:40183 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbeEHEPR (ORCPT ); Tue, 8 May 2018 00:15:17 -0400 Received: by mail-pg0-f66.google.com with SMTP id l2-v6so20580135pgc.7; Mon, 07 May 2018 21:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=/AAhwSEYsaC8NkmBJMeZcvvcnIYCRvjupNs4QbtElTs=; b=odAFrbq0mY9EHm05T0Sjvr2RfivpHZyIqzmXbdClTnqujtBBnbyQwvTk+Hlem+Bmd7 /QEhQyYGCOHPCW3xpwMA81pNhXuil5hI+TpFjSI/brTyH8ii1iXkFY1HXMpxOFAJ9lIH YDZJhLsyTzHZcc1BWDmtNlr0VpCAWXLfZaLkEbujIXzR9BNQDjJS34ydxsIog3oPMWYn zxe4Ka9CVAHxTJqChgBVXVLz+RxNrJ2JZAc36Doy0KfG0Z9nUTMZDiqewBV7UyUXGSVF lSUE433Qs/EfZ8sfOc0s0vYy7YdGotNAgNFzb3WxAFW/g6pggrvXaMfya3Q9b1fb3El7 SeWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=/AAhwSEYsaC8NkmBJMeZcvvcnIYCRvjupNs4QbtElTs=; b=KQQp/bp6EdeTEFj+lx3POZIByPkwHOtBqo3jWsORBYeKpSNUhPcyzmKtu6P37F3/vu 8ESIAdU87XvVIS4hZ0RQWGMvYGCNCYJFdf4oov3rvA0gUeptQdbgRlXKLX7joz18R7+A KGYr95x1Osu5iDIwprU+qGamIN5FL2jYRyROXglM5gI9S1MZR7Opg5Ela9f6r94BKl+O Ye/B64FTSjIxHvnovibE3KNZp922zZCdZ1Qky8ZlEa49y3kPPeGSrxr8IBkSnbo/mYKq 67Z6ipsW8uik+o8slViPOmYSSyKvR9vdWYlmjQLBijek2MRuVdTd278WyYs0mkC/9phb cMig== X-Gm-Message-State: ALQs6tAGJDCUj+gouaw2IqXuC4kmAdk89GZ4C9PM5/ehm4E2TMOPvzzb Ntc/6CROHO+EK3lWMTtLSYg= X-Received: by 2002:a63:6b43:: with SMTP id g64-v6mr24073161pgc.337.1525752916709; Mon, 07 May 2018 21:15:16 -0700 (PDT) Received: from ?IPv6:2600:1011:b00e:2b64:3c9:b612:3261:6646? ([2600:1011:b00e:2b64:3c9:b612:3261:6646]) by smtp.gmail.com with ESMTPSA id s8sm42814219pfh.30.2018.05.07.21.15.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 May 2018 21:15:15 -0700 (PDT) Date: Mon, 07 May 2018 20:23:09 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <20180507231506.4891-1-mcgrof@kernel.org> References: <20180507231506.4891-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] mm: expland documentation over __read_mostly To: "Luis R. Rodriguez" , tglx@linutronix.de, arnd@arndb.de, cl@linux.com CC: keescook@chromium.org, luto@amacapital.net, longman@redhat.com, viro@zeniv.linux.org.uk, willy@infradead.org, ebiederm@xmission.com, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org From: Joel Fernandes Message-ID: <9AE4F1FC-2B6A-4EB4-8626-9936B8EB5CBB@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 7, 2018 4:15:06 PM PDT, "Luis R=2E Rodriguez" = wrote: >__read_mostly can easily be misused by folks, its not meant for >just read-only data=2E There are performance reasons for using it, but >we also don't provide any guidance about its use=2E Provide a bit more >guidance over it use=2E > >Signed-off-by: Luis R=2E Rodriguez >--- > include/linux/cache=2Eh | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >Every now and then we get a patch suggesting to use __read_mostly for >something new or old but with no justifications=2E Add a bit more >verbiage to help guide its users=2E > >Is this sufficient documentation to at least ask for a reason in the >commit >log as to why its being used for new entries? Or should we be explicit >and >ask for such justifications in commit logs? Taken from prior >discussions >with Christoph Lameter [0] over its use=2E > >[0] >https://lkml=2Ekernel=2Eorg/r/alpine=2EDEB=2E2=2E11=2E1504301343190=2E288= 79@gentwo=2Eorg > >diff --git a/include/linux/cache=2Eh b/include/linux/cache=2Eh >index 750621e41d1c=2E=2E62bc5adc0ed5 100644 >--- a/include/linux/cache=2Eh >+++ b/include/linux/cache=2Eh >@@ -15,8 +15,14 @@ >=20 > /* >* __read_mostly is used to keep rarely changing variables out of >frequently >- * updated cachelines=2E If an architecture doesn't support it, ignore >the >- * hint=2E >+ * updated cachelines=2E Its use should be reserved for data that is >used >+ * frequently in hot paths=2E Performance traces can help decide when to >use >+ * this=2E You want __read_mostly data to be tightly packed, so that in >the >+ * best case multiple frequently read variables for a hot path will be >next >+ * to each other in order to reduce the number of cachelines needed to >+ * execute a critial path=2E We should be mindful and selective if its Nit: in its use=2E - Joel >use=2E >+ * >+ * If an architecture doesn't support it, ignore the hint=2E > */ > #ifndef __read_mostly > #define __read_mostly --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E