Skip to contentSkip to conversation

objrmap fix for nonlinear

PATCH In review Dave McCracken 2 participants 3 messages Mar 12, 2003

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

PATCH 1/1 objrmap fix for nonlinear

This patch should fix the remap_file_pages problem for object-based rmap. I added a function that converts an object-based page to a pte_chain-based page. It's a little tricky because it has to preallocated all the pte_chains it needs before taking the lock since the page can't be allowed outside the lock in an intermediate state. Fortunately I know how many pte_chains are needed in advance.

I also condensed some of the common code and added comments. One side effect is I removed taking the page_table_lock during the pte lookups. I've convinced myself that anyone else trying to touch those areas will block on the locks I already hold. It survives the abuse test I've thrown at it.

Dave McCracken

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

./mm/fremap.c +10 -5
@@ -62,6 +62,16 @@
 	pte_chain = pte_chain_alloc(GFP_KERNEL);
 	if (!pte_chain)
 		goto err;
+
+	/*
+	 * Convert this page to anon for objrmap if it's nonlinear
+	 */
+	pgidx = (addr - vma->vm_start) >> PAGE_SHIFT;
+	pgidx += vma->vm_pgoff;
+	pgidx >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
+	if (!PageAnon(page) && (page->index != pgidx))
+		page_convert_anon(page);
+
 	pgd = pgd_offset(mm, addr);
 	spin_lock(&mm->page_table_lock);
 
@@ -80,11 +90,6 @@
 	flush_icache_page(vma, page);
 	entry = mk_pte(page, prot);
 	set_pte(pte, entry);
-	pgidx = (addr - vma->vm_start) >> PAGE_SHIFT;
-	pgidx += vma->vm_pgoff;
-	pgidx >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
-	if (page->index != pgidx)
-		SetPageAnon(page);
 	pte_chain = page_add_rmap(page, pte, pte_chain);
 	pte_unmap(pte);
  	if (flush)
./mm/rmap.c +213 -54

362 lines not on this page · raw message

reviewer
#1 lore raw
Quoted 3 lines · Dave McCracken

I've convinced myself that anyone else trying to touch those areas will block on the locks I already hold. It survives the abuse test I've thrown at it.

Could I get a copy of that abuse test ? ;))

(if possible to riel-at-redhat.com, which I'm not throwing out to the spammers since I don't control the spam filtering for that address)

thanks,

Rik (who wants to port some of the partial object rmap code to 2.4)

#2 lore raw

--On Wednesday, March 12, 2003 18:16:01 -0500 Rik van Riel

Quoted 1 line · <[email protected]> wrote:

Could I get a copy of that abuse test ? ;))

My abuse test is to take a dual 200Mhz PentiumPro w/ 128M memory and do a 'make -j 50 bzImage' on a kernel tree. So far it's proven to find some fairly low-probability races.

Dave

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