All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-fix-is_pinnable_page-against-on-cma-page-v5.patch added to mm-unstable branch
@ 2022-05-12 20:45 Andrew Morton
  2022-05-12 21:28 ` Minchan Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2022-05-12 20:45 UTC (permalink / raw)
  To: mm-commits, paulmck, jhubbard, david, minchan, akpm


The patch titled
     Subject: mm-fix-is_pinnable_page-against-on-cma-page-v5
has been added to the -mm mm-unstable branch.  Its filename is
     mm-fix-is_pinnable_page-against-on-cma-page-v5.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-is_pinnable_page-against-on-cma-page-v5.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Minchan Kim <minchan@kernel.org>
Subject: mm-fix-is_pinnable_page-against-on-cma-page-v5

  * clarification why we need READ_ONCE - Paul
  * Add a comment about READ_ONCE - John

Link: https://lkml.kernel.org/r/20220512204143.3961150-1-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: "Paul E . McKenney" <paulmck@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/mm.h |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/include/linux/mm.h~mm-fix-is_pinnable_page-against-on-cma-page-v5
+++ a/include/linux/mm.h
@@ -1627,13 +1627,14 @@ static inline bool is_pinnable_page(stru
 {
 #ifdef CONFIG_CMA
 	/*
-	 * use volatile to use local variable mt instead of
-	 * refetching mt value.
+	 * Defend against future compiler LTO features, or code refactoring
+	 * that inlines the above function, by forcing a single read. Because,
+	 * this routine races with set_pageblock_migratetype(), and we want to
+	 * avoid reading zero, when actually one or the other flags was set.
 	 */
-	int __mt = get_pageblock_migratetype(page);
 	int mt = __READ_ONCE(__mt);
 
-	if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE)
+	if (mt & (MIGRATE_CMA | MIGRATE_ISOLATE))
 		return false;
 #endif
 
_

Patches currently in -mm which might be from minchan@kernel.org are

mm-fix-is_pinnable_page-against-on-cma-page.patch
mm-fix-is_pinnable_page-against-on-cma-page-v5.patch
mm-dont-be-stuck-to-rmap-lock-on-reclaim-path.patch


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + mm-fix-is_pinnable_page-against-on-cma-page-v5.patch added to mm-unstable branch
  2022-05-12 20:45 + mm-fix-is_pinnable_page-against-on-cma-page-v5.patch added to mm-unstable branch Andrew Morton
@ 2022-05-12 21:28 ` Minchan Kim
  2022-05-12 21:34   ` Minchan Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Minchan Kim @ 2022-05-12 21:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, paulmck, jhubbard, david

On Thu, May 12, 2022 at 01:45:05PM -0700, Andrew Morton wrote:
> 
> The patch titled
>      Subject: mm-fix-is_pinnable_page-against-on-cma-page-v5
> has been added to the -mm mm-unstable branch.  Its filename is
>      mm-fix-is_pinnable_page-against-on-cma-page-v5.patch
> 
> This patch will shortly appear at
>      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-is_pinnable_page-against-on-cma-page-v5.patch
> 
> This patch will later appear in the mm-unstable branch at
>     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
> 
> ------------------------------------------------------
> From: Minchan Kim <minchan@kernel.org>
> Subject: mm-fix-is_pinnable_page-against-on-cma-page-v5
> 
>   * clarification why we need READ_ONCE - Paul
>   * Add a comment about READ_ONCE - John
> 
> Link: https://lkml.kernel.org/r/20220512204143.3961150-1-minchan@kernel.org
> Signed-off-by: Minchan Kim <minchan@kernel.org>
> Cc: "Paul E . McKenney" <paulmck@kernel.org>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: David Hildenbrand <david@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  include/linux/mm.h |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> --- a/include/linux/mm.h~mm-fix-is_pinnable_page-against-on-cma-page-v5
> +++ a/include/linux/mm.h
> @@ -1627,13 +1627,14 @@ static inline bool is_pinnable_page(stru
>  {
>  #ifdef CONFIG_CMA
>  	/*
> -	 * use volatile to use local variable mt instead of
> -	 * refetching mt value.
> +	 * Defend against future compiler LTO features, or code refactoring
> +	 * that inlines the above function, by forcing a single read. Because,
> +	 * this routine races with set_pageblock_migratetype(), and we want to
> +	 * avoid reading zero, when actually one or the other flags was set.
>  	 */
> -	int __mt = get_pageblock_migratetype(page);

It makes build failure.

Could you pick this up instead?

https://lore.kernel.org/all/Yn10GkInyZNtqASa@google.com/

Sorry for confusing.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: + mm-fix-is_pinnable_page-against-on-cma-page-v5.patch added to mm-unstable branch
  2022-05-12 21:28 ` Minchan Kim
@ 2022-05-12 21:34   ` Minchan Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Minchan Kim @ 2022-05-12 21:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mm-commits, paulmck, jhubbard, david

On Thu, May 12, 2022 at 02:28:33PM -0700, Minchan Kim wrote:
> On Thu, May 12, 2022 at 01:45:05PM -0700, Andrew Morton wrote:
> > 
> > The patch titled
> >      Subject: mm-fix-is_pinnable_page-against-on-cma-page-v5
> > has been added to the -mm mm-unstable branch.  Its filename is
> >      mm-fix-is_pinnable_page-against-on-cma-page-v5.patch
> > 
> > This patch will shortly appear at
> >      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-is_pinnable_page-against-on-cma-page-v5.patch
> > 
> > This patch will later appear in the mm-unstable branch at
> >     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > 
> > Before you just go and hit "reply", please:
> >    a) Consider who else should be cc'ed
> >    b) Prefer to cc a suitable mailing list as well
> >    c) Ideally: find the original patch on the mailing list and do a
> >       reply-to-all to that, adding suitable additional cc's
> > 
> > *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> > 
> > The -mm tree is included into linux-next via the mm-everything
> > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > and is updated there every 2-3 working days
> > 
> > ------------------------------------------------------
> > From: Minchan Kim <minchan@kernel.org>
> > Subject: mm-fix-is_pinnable_page-against-on-cma-page-v5
> > 
> >   * clarification why we need READ_ONCE - Paul
> >   * Add a comment about READ_ONCE - John
> > 
> > Link: https://lkml.kernel.org/r/20220512204143.3961150-1-minchan@kernel.org
> > Signed-off-by: Minchan Kim <minchan@kernel.org>
> > Cc: "Paul E . McKenney" <paulmck@kernel.org>
> > Cc: John Hubbard <jhubbard@nvidia.com>
> > Cc: David Hildenbrand <david@redhat.com>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> > 
> >  include/linux/mm.h |    9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > --- a/include/linux/mm.h~mm-fix-is_pinnable_page-against-on-cma-page-v5
> > +++ a/include/linux/mm.h
> > @@ -1627,13 +1627,14 @@ static inline bool is_pinnable_page(stru
> >  {
> >  #ifdef CONFIG_CMA
> >  	/*
> > -	 * use volatile to use local variable mt instead of
> > -	 * refetching mt value.
> > +	 * Defend against future compiler LTO features, or code refactoring
> > +	 * that inlines the above function, by forcing a single read. Because,
> > +	 * this routine races with set_pageblock_migratetype(), and we want to
> > +	 * avoid reading zero, when actually one or the other flags was set.
> >  	 */
> > -	int __mt = get_pageblock_migratetype(page);
> 
> It makes build failure.
> 
> Could you pick this up instead?
> 
> https://lore.kernel.org/all/Yn10GkInyZNtqASa@google.com/

I really don't understand why it works or don't sometimes
At least, it works 

https://lore.kernel.org/lkml/Yn10GkInyZNtqASa@google.com/
> 
> Sorry for confusing.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-12 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 20:45 + mm-fix-is_pinnable_page-against-on-cma-page-v5.patch added to mm-unstable branch Andrew Morton
2022-05-12 21:28 ` Minchan Kim
2022-05-12 21:34   ` Minchan Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.