From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF94AC47257 for ; Wed, 6 May 2020 23:03:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 99ABE2087E for ; Wed, 6 May 2020 23:03:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wyt/JGZo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99ABE2087E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4BA01900002; Wed, 6 May 2020 19:03:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 473B48E0003; Wed, 6 May 2020 19:03:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3802D900002; Wed, 6 May 2020 19:03:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 216988E0003 for ; Wed, 6 May 2020 19:03:26 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C3126181AC9C6 for ; Wed, 6 May 2020 23:03:25 +0000 (UTC) X-FDA: 76787822370.24.gold61_1de3186ba9a56 X-HE-Tag: gold61_1de3186ba9a56 X-Filterd-Recvd-Size: 4258 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 May 2020 23:03:25 +0000 (UTC) Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C25C207DD for ; Wed, 6 May 2020 23:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588806204; bh=XcKljOyA8MI70ejLn0nQwtirIILJp1QajO5LmILJmlg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Wyt/JGZoLBoCyrBbn+nfKaptsftweK+J/hSN/lanGug2dLve6x9IIG1O6u0eohq7L g4TBx58wLXTZ9ZQQB9ddeTSyd/ZG5lVk4uhkoH+gu/r1TWmz6j62pfp9AeV6LqRpFR L7TA0Un44Wj8o//D5Mkep7vCrBa8XeG24QfzeOpw= Received: by mail-ed1-f48.google.com with SMTP id f12so3591995edn.12 for ; Wed, 06 May 2020 16:03:24 -0700 (PDT) X-Gm-Message-State: AGi0PuaDLQ+Pd2B7SjVewAtw0aHMmePErl+aNXHRQ8nO0eFr+t7JzGvV KrpFPGvK3l18kLui2mmGvZDx/1LB5Buiso5Eejc= X-Google-Smtp-Source: APiQypL7jasVVzwLhx3EaVL/2cJEk9MJtHeXT6qkCc1Y5SzHENoGQP9owkfX68fn1CyN/mdLVs9MduopS6s761TG+e0= X-Received: by 2002:a50:d6d0:: with SMTP id l16mr9650852edj.317.1588806202552; Wed, 06 May 2020 16:03:22 -0700 (PDT) MIME-Version: 1.0 References: <20180508181924.19939-1-mcgrof@kernel.org> In-Reply-To: <20180508181924.19939-1-mcgrof@kernel.org> From: Luis Chamberlain Date: Wed, 6 May 2020 17:03:15 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] mm: expland documentation over __read_mostly To: Thomas Gleixner , Arnd Bergmann , Christopher Lamenter , Rafael Aquini Cc: Kees Cook , Andy Lutomirski , Waiman Long , Al Viro , David Howells , Matthew Wilcox , "Eric W. Biederman" , Randy Dunlap , joel.opensrc@gmail.com, linux-arch , linux-mm , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, May 8, 2018 at 12:19 PM Luis R. Rodriguez wrote: > > __read_mostly can easily be misused by folks, its not meant for > just read-only data. There are performance reasons for using it, but > we also don't provide any guidance about its use. Provide a bit more > guidance over it use. > > Acked-by: Christoph Lameter > Signed-off-by: Luis R. Rodriguez After 2 years, this patch was never applied... and so people can easily keep misusing this. I'll resend now. Luis > --- > include/linux/cache.h | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/include/linux/cache.h b/include/linux/cache.h > index 750621e41d1c..4967566ed08c 100644 > --- a/include/linux/cache.h > +++ b/include/linux/cache.h > @@ -15,8 +15,16 @@ > > /* > * __read_mostly is used to keep rarely changing variables out of frequently > - * updated cachelines. If an architecture doesn't support it, ignore the > - * hint. > + * updated cachelines. Its use should be reserved for data that is used > + * frequently in hot paths. Performance traces can help decide when to use > + * this. 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. We should be mindful and selective of its use. > + * ie: if you're going to use it please supply a *good* justification in your > + * commit log. > + * > + * If an architecture doesn't support it, ignore the hint. > */ > #ifndef __read_mostly > #define __read_mostly > -- > 2.17.0 >