Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413017

Re: [linux-next: Tree for Jun 1] __khugepaged_exit rwsem_down_write_failed lockup

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [linux-next: Tree for Jun 1] __khugepaged_exit rwsem_down_write_failed lockup
Date 2016-06-03 12:10 +0200
Message-ID <rFUdc-1OZ-33@gated-at.bofh.it> (permalink)
References (2 earlier) <rFx6V-48t-13@gated-at.bofh.it> <rFRyG-9r-21@gated-at.bofh.it> <rFRIl-cH-13@gated-at.bofh.it> <rFSXL-T2-21@gated-at.bofh.it> <rFU3x-1wB-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri 03-06-16 11:55:49, Michal Hocko wrote:
> On Fri 03-06-16 17:43:47, Sergey Senozhatsky wrote:
> > On (06/03/16 09:25), Michal Hocko wrote:
> > > > it's quite hard to trigger the bug (somehow), so I can't
> > > > follow up with more information as of now.
> > 
> > either I did something very silly fixing up the patch, or the
> > patch may be causing general protection faults on my system.
> > 
> > RIP collect_mm_slot() + 0x42/0x84
> > 	khugepaged
> 
> So is this really collect_mm_slot called directly from khugepaged or is
> some inlining going on there?
> 
> > 	prepare_to_wait_event
> > 	maybe_pmd_mkwrite
> > 	kthread
> > 	_raw_sin_unlock_irq
> > 	ret_from_fork
> > 	kthread_create_on_node
> > 
> > collect_mm_slot() + 0x42/0x84 is
> 
> I guess that the problem is that I have missed that __khugepaged_exit
> doesn't clear the cached khugepaged_scan.mm_slot. Does the following on
> top fixes that?

That wouldn't be sufficient after a closer look. We need to do the same
from khugepaged_scan_mm_slot when atomic_inc_not_zero fails. So I guess
it would be better to stick it into collect_mm_slot.

Thanks for your testing!
---
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 6574c62ca4a3..0432581fb87c 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2011,6 +2011,9 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
 		/* khugepaged_mm_lock actually not necessary for the below */
 		free_mm_slot(mm_slot);
 		mmdrop(mm);
+
+		if (khugepaged_scan.mm_slot == mm_slot)
+			khugepaged_scan.mm_slot = NULL;
 	}
 }
 
-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

linux-next: Tree for Jun 1 Stephen Rothwell <sfr@canb.auug.org.au> - 2016-06-01 05:20 +0200
  [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-02 04:00 +0200
    Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-02 11:30 +0200
      Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-06-02 14:10 +0200
        Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-02 14:30 +0200
          Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Andrea Arcangeli <aarcange@redhat.com> - 2016-06-03 16:00 +0200
            Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-03 16:50 +0200
              Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Andrea Arcangeli <aarcange@redhat.com> - 2016-06-03 17:20 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-07 09:40 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Vlastimil Babka <vbabka@suse.cz> - 2016-06-08 10:20 +0200
      Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-03 09:20 +0200
        Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-03 09:30 +0200
          Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-03 10:50 +0200
            Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-03 12:00 +0200
              Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-03 12:10 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-06-03 15:40 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-03 15:50 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-03 15:50 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-04 10:00 +0200
                Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Michal Hocko <mhocko@kernel.org> - 2016-06-06 10:40 +0200
    Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Vlastimil Babka <vbabka@suse.cz> - 2016-06-02 15:30 +0200
      Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Ebru Akagunduz <ebru.akagunduz@gmail.com> - 2016-06-02 21:00 +0200
        Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-03 03:10 +0200
          Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-03 03:30 +0200
            Re: [linux-next: Tree for Jun 1] __khugepaged_exit  rwsem_down_write_failed lockup Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-03 06:20 +0200
      [PATCH] mm, thp: fix locking inconsistency in collapse_huge_page Ebru Akagunduz <ebru.akagunduz@gmail.com> - 2016-06-03 14:30 +0200
        Re: [PATCH] mm, thp: fix locking inconsistency in collapse_huge_page Vlastimil Babka <vbabka@suse.cz> - 2016-06-06 15:10 +0200
          Re: [PATCH] mm, thp: fix locking inconsistency in collapse_huge_page Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-09 06:00 +0200

csiph-web