Skip to contentSkip to conversation

install_page() lockup

PATCH Andrew Morton 3 participants 4 messages Oct 23, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I'm getting lockups in install_page() with shared pagetables enabled. I haven't really delved into it. It happens under heavy memory pressure on SMP.

Ingo's new patch is using install_page much more than we used to (I don't think I've ever run it before), so we're running fairly untested codepaths here.

I tried this:

 mm/fremap.c |    2 ++
 1 files changed, 2 insertions(+)
mm/fremap.c renamed from mm/fremap.c~a +2 -0
@@ -72,7 +72,9 @@ int install_page(struct mm_struct *mm, s
 		pte_page_lock(ptepage);
 		if (page_count(ptepage) > 1) {
 			pte = pte_unshare(mm, pmd, addr);
+			pte_page_unlock(ptepage);
 			ptepage = pmd_page(*pmd);
+			pte_page_lock(ptepage);
 		} else
 			pte = pte_offset_map(pmd, addr);
 	} else {

.

Because doing a pte_page_lock(ptepage) and then losing track of the page we just locked looks fishy. Didn't help though.

Dave could you please review the code in there? It's probably something simple.

Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#1 lore raw
Quoted 3 lines · Andrew Morton

Ingo's new patch is using install_page much more than we used to (I don't think I've ever run it before), so we're running fairly untested codepaths here.

i added install_page() for fremap()'s purposes so i'd be surprised if anything else used it. I have shared-pte turned off in my tests, will try with it on as well.

Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#3 lore raw
In reply to Andrew Morton

--On Tuesday, October 22, 2002 22:37:10 -0700 Andrew Morton

Quoted 8 lines · <[email protected]> wrote:

I'm getting lockups in install_page() with shared pagetables enabled. I haven't really delved into it. It happens under heavy memory pressure on SMP.

Ingo's new patch is using install_page much more than we used to (I don't think I've ever run it before), so we're running fairly untested codepaths here.

As Ingo said, he added install_page.

Quoted 7 lines

I tried this:

(snip)

Because doing a pte_page_lock(ptepage) and then losing track of the page we just locked looks fishy. Didn't help though.

The code was correct. pte_unshare moves the lock to the new pte page if it installs one. I know that's not real clean, but it eliminates multiple unlock/relock sequences.

Quoted 2 lines

Dave could you please review the code in there? It's probably something simple.

I found the problem. In memory.c:do_file_page it unlocks the page_table_lock. In the new locking scheme, it's actually the pte_page_lock that's held instead.

The patch to fix this is attached.

Dave McCracken

======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
[email protected] T/L 678-3059

mm/memory.c +2 -1
@@ -1823,6 +1823,7 @@
 static int do_file_page(struct mm_struct * mm, struct vm_area_struct * vma,
 	unsigned long address, int write_access, pte_t *pte, pmd_t *pmd)
 {
+	struct page *ptepage = pmd_page(*pmd);
 	unsigned long pgoff;
 	int err;
 
@@ -1840,7 +1841,7 @@
 	pgoff = pte_to_pgoff(*pte);
 
 	pte_unmap(pte);
-	spin_unlock(&mm->page_table_lock);
+	pte_page_unlock(ptepage);
 
 	err = vma->vm_ops->populate(vma, address & PAGE_MASK, PAGE_SIZE, vma->vm_page_prot, pgoff, 0);
 	if (err == -ENOMEM)
#2 lore raw
In reply to Ingo Molnar

--On Wednesday, October 23, 2002 08:49:11 +0200 Ingo Molnar <[email protected]>

Quoted 3 lines · wrote:

i added install_page() for fremap()'s purposes so i'd be surprised if anything else used it. I have shared-pte turned off in my tests, will try with it on as well.

As I sent in an earlier mail, I found the bug. do_file_page needs to unlock the pte_page_lock, not the page_table_lock.

If I understand the use of install_page correctly, I don't see a reason why it should be calling pte_unshare. If it's only installing pages from existing shared regions it should leave the pte page shared. The only reason to call pte_unshare is if the vma for that mm has changed, making the sharing decision invalid. Am I missing how this is being used?

Dave McCracken

======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
[email protected] T/L 678-3059

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/