Re: [PATCH] mm: expland documentation over __read_mostly
On Wed, May 06, 2020 at 11:13:53PM +, Luis Chamberlain wrote: > + * execute a critial path. We should be mindful and selective of its use. "critical"
Re: [PATCH] mm: expland documentation over __read_mostly
On Wed, May 06, 2020 at 11:13:53PM +, Luis Chamberlain 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. s/it/its same goes for the subject, as I think there is a minor typo: s/expland/expand > > Acked-by: Christoph Lameter > Signed-off-by: Luis Chamberlain > --- > > I sent this 2 years ago, but it fell through the cracks. This time > I'm adding Andrew Morton now, the fix0r-of-falling-through-the-cracks. > > Resending as I just saw a patch which doesn't clearly justifiy the > merits of the use of __read_mostly on it. > That would be my fault! (sorry) given the rationale below, the patch I sent really doesn't need the hint. Thanks for the extra bit of education here. (not an excuse) In a glance over the source tree, though, it seems most of the hinting cases are doing it in the misguided way. > 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 @@ > > /* > * __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 > */ > #ifndef __read_mostly > #define __read_mostly > -- > 2.25.1 > Acked-by: Rafael Aquini
[PATCH] mm: expland documentation over __read_mostly
__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 Chamberlain --- I sent this 2 years ago, but it fell through the cracks. This time I'm adding Andrew Morton now, the fix0r-of-falling-through-the-cracks. Resending as I just saw a patch which doesn't clearly justifiy the merits of the use of __read_mostly on it. 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 @@ /* * __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 */ #ifndef __read_mostly #define __read_mostly -- 2.25.1
Re: [PATCH] mm: expland documentation over __read_mostly
On Tue, May 08, 2018 at 08:39:30AM -0700, Randy Dunlap wrote: > On 05/08/2018 04:23 AM, Matthew Wilcox wrote: > > On Tue, May 08, 2018 at 09:28:14AM +0100, David Howells wrote: > >> Randy Dunlapwrote: > >> > + * execute a critial path. We should be mindful and selective if its > use. > >>> > >>> of its > >>> use. > >> > >>in its > >> use. > > with its > > use. > > > > Nah, just kidding. Let's go with "in". > > > > Yeah, no, I don't care. Just flip a 3-sided coin. Heh, the coin says "of". I also added: * ie: if you're going to use it please supply a *good* justification in your * commit log. Sending v2. Luis
Re: [PATCH] mm: expland documentation over __read_mostly
On Tue, May 08, 2018 at 08:39:30AM -0700, Randy Dunlap wrote: > On 05/08/2018 04:23 AM, Matthew Wilcox wrote: > > On Tue, May 08, 2018 at 09:28:14AM +0100, David Howells wrote: > >> Randy Dunlap wrote: > >> > + * execute a critial path. We should be mindful and selective if its > use. > >>> > >>> of its > >>> use. > >> > >>in its > >> use. > > with its > > use. > > > > Nah, just kidding. Let's go with "in". > > > > Yeah, no, I don't care. Just flip a 3-sided coin. Heh, the coin says "of". I also added: * ie: if you're going to use it please supply a *good* justification in your * commit log. Sending v2. Luis
Re: [PATCH] mm: expland documentation over __read_mostly
On 05/08/2018 04:23 AM, Matthew Wilcox wrote: > On Tue, May 08, 2018 at 09:28:14AM +0100, David Howells wrote: >> Randy Dunlapwrote: >> + * execute a critial path. We should be mindful and selective if its use. >>> >>> of its use. >> >>in its >> use. >with its > use. > > Nah, just kidding. Let's go with "in". > Yeah, no, I don't care. Just flip a 3-sided coin. -- ~Randy
Re: [PATCH] mm: expland documentation over __read_mostly
On 05/08/2018 04:23 AM, Matthew Wilcox wrote: > On Tue, May 08, 2018 at 09:28:14AM +0100, David Howells wrote: >> Randy Dunlap wrote: >> + * execute a critial path. We should be mindful and selective if its use. >>> >>> of its use. >> >>in its >> use. >with its > use. > > Nah, just kidding. Let's go with "in". > Yeah, no, I don't care. Just flip a 3-sided coin. -- ~Randy
Re: [PATCH] mm: expland documentation over __read_mostly
On Mon, 7 May 2018, 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
Re: [PATCH] mm: expland documentation over __read_mostly
On Mon, 7 May 2018, 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
Re: [PATCH] mm: expland documentation over __read_mostly
On Tue, May 08, 2018 at 09:28:14AM +0100, David Howells wrote: > Randy Dunlapwrote: > > > > + * execute a critial path. We should be mindful and selective if its use. > > > > of its use. > >in its use. with its use. Nah, just kidding. Let's go with "in".
Re: [PATCH] mm: expland documentation over __read_mostly
On Tue, May 08, 2018 at 09:28:14AM +0100, David Howells wrote: > Randy Dunlap wrote: > > > > + * execute a critial path. We should be mindful and selective if its use. > > > > of its use. > >in its use. with its use. Nah, just kidding. Let's go with "in".
Re: [PATCH] mm: expland documentation over __read_mostly
Randy Dunlapwrote: > > + * execute a critial path. We should be mindful and selective if its use. > > of its use. in its use. David
Re: [PATCH] mm: expland documentation over __read_mostly
Randy Dunlap wrote: > > + * execute a critial path. We should be mindful and selective if its use. > > of its use. in its use. David
Re: [PATCH] mm: expland documentation over __read_mostly
On May 7, 2018 4:15:06 PM PDT, "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. > >Signed-off-by: Luis R. Rodriguez >--- > include/linux/cache.h | 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. Add a bit more >verbiage to help guide its users. > >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. > >[0] >https://lkml.kernel.org/r/alpine.deb.2.11.1504301343190.28...@gentwo.org > >diff --git a/include/linux/cache.h b/include/linux/cache.h >index 750621e41d1c..62bc5adc0ed5 100644 >--- a/include/linux/cache.h >+++ b/include/linux/cache.h >@@ -15,8 +15,14 @@ > > /* >* __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 if its Nit: in its use. - Joel >use. >+ * >+ * If an architecture doesn't support it, ignore the hint. > */ > #ifndef __read_mostly > #define __read_mostly -- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Re: [PATCH] mm: expland documentation over __read_mostly
On May 7, 2018 4:15:06 PM PDT, "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. > >Signed-off-by: Luis R. Rodriguez >--- > include/linux/cache.h | 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. Add a bit more >verbiage to help guide its users. > >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. > >[0] >https://lkml.kernel.org/r/alpine.deb.2.11.1504301343190.28...@gentwo.org > >diff --git a/include/linux/cache.h b/include/linux/cache.h >index 750621e41d1c..62bc5adc0ed5 100644 >--- a/include/linux/cache.h >+++ b/include/linux/cache.h >@@ -15,8 +15,14 @@ > > /* >* __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 if its Nit: in its use. - Joel >use. >+ * >+ * If an architecture doesn't support it, ignore the hint. > */ > #ifndef __read_mostly > #define __read_mostly -- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Re: [PATCH] mm: expland documentation over __read_mostly
On 05/07/2018 04:15 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. > > Signed-off-by: Luis R. Rodriguez> --- > include/linux/cache.h | 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. Add a bit more > verbiage to help guide its users. > > 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. > > [0] https://lkml.kernel.org/r/alpine.deb.2.11.1504301343190.28...@gentwo.org > > diff --git a/include/linux/cache.h b/include/linux/cache.h > index 750621e41d1c..62bc5adc0ed5 100644 > --- a/include/linux/cache.h > +++ b/include/linux/cache.h > @@ -15,8 +15,14 @@ > > /* > * __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 if its use. of its use. > + * > + * If an architecture doesn't support it, ignore the hint. > */ > #ifndef __read_mostly > #define __read_mostly > -- ~Randy
Re: [PATCH] mm: expland documentation over __read_mostly
On 05/07/2018 04:15 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. > > Signed-off-by: Luis R. Rodriguez > --- > include/linux/cache.h | 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. Add a bit more > verbiage to help guide its users. > > 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. > > [0] https://lkml.kernel.org/r/alpine.deb.2.11.1504301343190.28...@gentwo.org > > diff --git a/include/linux/cache.h b/include/linux/cache.h > index 750621e41d1c..62bc5adc0ed5 100644 > --- a/include/linux/cache.h > +++ b/include/linux/cache.h > @@ -15,8 +15,14 @@ > > /* > * __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 if its use. of its use. > + * > + * If an architecture doesn't support it, ignore the hint. > */ > #ifndef __read_mostly > #define __read_mostly > -- ~Randy
[PATCH] mm: expland documentation over __read_mostly
__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. Signed-off-by: Luis R. Rodriguez--- include/linux/cache.h | 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. Add a bit more verbiage to help guide its users. 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. [0] https://lkml.kernel.org/r/alpine.deb.2.11.1504301343190.28...@gentwo.org diff --git a/include/linux/cache.h b/include/linux/cache.h index 750621e41d1c..62bc5adc0ed5 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -15,8 +15,14 @@ /* * __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 if its use. + * + * If an architecture doesn't support it, ignore the hint. */ #ifndef __read_mostly #define __read_mostly -- 2.17.0
[PATCH] mm: expland documentation over __read_mostly
__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. Signed-off-by: Luis R. Rodriguez --- include/linux/cache.h | 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. Add a bit more verbiage to help guide its users. 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. [0] https://lkml.kernel.org/r/alpine.deb.2.11.1504301343190.28...@gentwo.org diff --git a/include/linux/cache.h b/include/linux/cache.h index 750621e41d1c..62bc5adc0ed5 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -15,8 +15,14 @@ /* * __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 if its use. + * + * If an architecture doesn't support it, ignore the hint. */ #ifndef __read_mostly #define __read_mostly -- 2.17.0