linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: thp: fix a double unlock bug
@ 2021-06-01  9:24 Dan Carpenter
  2021-06-01 10:08 ` Mel Gorman
  2021-06-01 17:30 ` Yang Shi
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-06-01  9:24 UTC (permalink / raw)
  To: Andrew Morton, Yang Shi
  Cc: Mel Gorman, linux-mm, linux-kernel, kernel-janitors

We're supposed to be holding the "vmf->ptl" spin_lock when we goto
out_map.  The lock is dropped after if finishes cleaning up.

Fixes: 9aff7b33c74a ("mm: thp: refactor NUMA fault handling")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 mm/huge_memory.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index e353bbc6cee3..caa0148f15bb 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1465,10 +1465,8 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
 
 	pmd = pmd_modify(oldpmd, vma->vm_page_prot);
 	page = vm_normal_page_pmd(vma, haddr, pmd);
-	if (!page) {
-		spin_unlock(vmf->ptl);
+	if (!page)
 		goto out_map;
-	}
 
 	/* See similar comment in do_numa_page for explanation */
 	if (!was_writable)
-- 
2.30.2


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

* Re: [PATCH] mm: thp: fix a double unlock bug
  2021-06-01  9:24 [PATCH] mm: thp: fix a double unlock bug Dan Carpenter
@ 2021-06-01 10:08 ` Mel Gorman
  2021-06-01 10:43   ` Dan Carpenter
  2021-06-01 17:30 ` Yang Shi
  1 sibling, 1 reply; 4+ messages in thread
From: Mel Gorman @ 2021-06-01 10:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Yang Shi, linux-mm, linux-kernel, kernel-janitors

On Tue, Jun 01, 2021 at 12:24:09PM +0300, Dan Carpenter wrote:
> We're supposed to be holding the "vmf->ptl" spin_lock when we goto
> out_map.  The lock is dropped after if finishes cleaning up.
> 
> Fixes: 9aff7b33c74a ("mm: thp: refactor NUMA fault handling")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Ouch.

Acked-by: Mel Gorman <mgorman@suse.de>

However, that git commit is not stable. Instead of Fixes: I would
suggest renaming the patch to "mm: thp: refactor NUMA fault handling
-fix" and replacing Fixes with "This patch is a fix to the mmotm patch
mm-thp-refactor-numa-fault-handling.patch". Andrew usually slots that
into the correct place in his quilt series and collapses the fixes before
sending to Linus which works better with bisection.

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH] mm: thp: fix a double unlock bug
  2021-06-01 10:08 ` Mel Gorman
@ 2021-06-01 10:43   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-06-01 10:43 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Andrew Morton, Yang Shi, linux-mm, linux-kernel, kernel-janitors

On Tue, Jun 01, 2021 at 11:08:49AM +0100, Mel Gorman wrote:
> On Tue, Jun 01, 2021 at 12:24:09PM +0300, Dan Carpenter wrote:
> > We're supposed to be holding the "vmf->ptl" spin_lock when we goto
> > out_map.  The lock is dropped after if finishes cleaning up.
> > 
> > Fixes: 9aff7b33c74a ("mm: thp: refactor NUMA fault handling")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Ouch.
> 
> Acked-by: Mel Gorman <mgorman@suse.de>
> 
> However, that git commit is not stable. Instead of Fixes: I would
> suggest renaming the patch to "mm: thp: refactor NUMA fault handling
> -fix" and replacing Fixes with "This patch is a fix to the mmotm patch
> mm-thp-refactor-numa-fault-handling.patch". Andrew usually slots that
> into the correct place in his quilt series and collapses the fixes before
> sending to Linus which works better with bisection.

I know that these normally get folded in, but I assumed that Andrew
would want the Fixes tag so that he could fold them in automatically
using a mutt alias. #OneClickShopping

regards,
dan carpenter

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

* Re: [PATCH] mm: thp: fix a double unlock bug
  2021-06-01  9:24 [PATCH] mm: thp: fix a double unlock bug Dan Carpenter
  2021-06-01 10:08 ` Mel Gorman
@ 2021-06-01 17:30 ` Yang Shi
  1 sibling, 0 replies; 4+ messages in thread
From: Yang Shi @ 2021-06-01 17:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Mel Gorman, Linux MM, Linux Kernel Mailing List,
	kernel-janitors

On Tue, Jun 1, 2021 at 2:24 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> We're supposed to be holding the "vmf->ptl" spin_lock when we goto
> out_map.  The lock is dropped after if finishes cleaning up.
>
> Fixes: 9aff7b33c74a ("mm: thp: refactor NUMA fault handling")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for catching this. Acked-by: Yang Shi <shy828301@gmail.com>

> ---
>  mm/huge_memory.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index e353bbc6cee3..caa0148f15bb 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1465,10 +1465,8 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
>
>         pmd = pmd_modify(oldpmd, vma->vm_page_prot);
>         page = vm_normal_page_pmd(vma, haddr, pmd);
> -       if (!page) {
> -               spin_unlock(vmf->ptl);
> +       if (!page)
>                 goto out_map;
> -       }
>
>         /* See similar comment in do_numa_page for explanation */
>         if (!was_writable)
> --
> 2.30.2
>

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

end of thread, other threads:[~2021-06-01 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01  9:24 [PATCH] mm: thp: fix a double unlock bug Dan Carpenter
2021-06-01 10:08 ` Mel Gorman
2021-06-01 10:43   ` Dan Carpenter
2021-06-01 17:30 ` Yang Shi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).