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=-10.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 6F577C38A2A for ; Thu, 7 May 2020 16:14:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3BDA22083B for ; Thu, 7 May 2020 16:14:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BDA22083B 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 BEDAA900005; Thu, 7 May 2020 12:14:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC554900002; Thu, 7 May 2020 12:14:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADA62900005; Thu, 7 May 2020 12:14:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 975CE900002 for ; Thu, 7 May 2020 12:14:29 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2C7E814534 for ; Thu, 7 May 2020 16:14:29 +0000 (UTC) X-FDA: 76790420658.04.week46_9ffbfd237a20 X-HE-Tag: week46_9ffbfd237a20 X-Filterd-Recvd-Size: 3780 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 May 2020 16:14:28 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id l25so3017521pgc.5 for ; Thu, 07 May 2020 09:14:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K01c3myVTwjqfRxKpVK6bNm+Qr9pA/B7t1+trJLymis=; b=rKm4BX6qWV867k3s4z+LETQHuS5+6L17SMbd5DJkOpOfj1+VHXvJikiylvl3icLh3P bCQ2y19VtLOk7OjqDKg3fRzdHVMSKYlp7AgKXPBIJ+a0mPJ+msbbyvIueIR5N0jagy/+ 75YFByRRjd8gAuL7ypHgbSkbia1XNVrcB57+wx9MlIB1c+nRjdQNGOpnzSxBe5V/qmY1 NrXZ1Kx1D8L8h6xUVxN7DiQHUqhusV0ZKaNE3M8vAP/yZTdsCUIXov0yOio+FMLA7ClQ Wkj318jODuNTKnpei0CMDKXfYnXSg3VPYvBK19SZJCCqeqL7jP/s14bLV5kpGRpnLbiH 5WNw== X-Gm-Message-State: AGi0PuYXILcUt2uxfWvGGeoKLMo7ZGdAYj3Al4eyNV31+qSD2hJBibLE fL4mt1HWzjq02t7r0bweJ8Y= X-Google-Smtp-Source: APiQypJlK3bEqBCOWQ9A1P7qBNuXOr+1NhJTCNPPunzRaibPtjOJ3Mug/c0efwn5onWc1A+geXg7uQ== X-Received: by 2002:a62:343:: with SMTP id 64mr14719426pfd.47.1588868067667; Thu, 07 May 2020 09:14:27 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id x193sm5626460pfd.54.2020.05.07.09.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 09:14:26 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id D578A403EA; Thu, 7 May 2020 16:14:25 +0000 (UTC) From: Luis Chamberlain To: cl@linux.com, akpm@linux-foundation.org Cc: arnd@arndb.de, willy@infradead.org, aquini@redhat.com, keescook@chromium.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH v2] mm: expand documentation over __read_mostly Date: Thu, 7 May 2020 16:14:24 +0000 Message-Id: <20200507161424.2584-1-mcgrof@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000023, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: __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 its use. Acked-by: Christoph Lameter Signed-off-by: Luis Chamberlain --- This v2 just has a few spelling fixes. include/linux/cache.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linux/cache.h b/include/linux/cache.h index 750621e41d1c..8106fb304fa7 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -15,8 +15,14 @@ =20 /* * __read_mostly is used to keep rarely changing variables out of freque= ntly - * 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 u= se + * this. You want __read_mostly data to be tightly packed, so that in th= e + * best case multiple frequently read variables for a hot path will be n= ext + * to each other in order to reduce the number of cachelines needed to + * execute a critical path. We should be mindful and selective of its us= e. + * ie: if you're going to use it please supply a *good* justification in= your + * commit log */ #ifndef __read_mostly #define __read_mostly --=20 2.25.1