Skip to contentSkip to conversation

use linear_page_index() in mm/mempolicy.c

PATCH William Lee Irwin III 1 participant 1 message Aug 13, 2004

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

mm/mempolicy.c is computing linear_page_index() by hand. This teaches alloc_page_vma() to use the pagemap.h helper function for it. This is particularly helpful for when how linear_page_index() is computed changes.

mm/mempolicy.c +1 -3
Index: spinlock-2.6.8-rc4/mm/mempolicy.c
===================================================================
@@ -668,11 +668,9 @@
 	if (unlikely(pol->policy == MPOL_INTERLEAVE)) {
 		unsigned nid;
 		if (vma) {
-			unsigned long off;
+			unsigned long off = linear_page_index(vma, addr);
 			BUG_ON(addr >= vma->vm_end);
 			BUG_ON(addr < vma->vm_start);
-			off = vma->vm_pgoff;
-			off += (addr - vma->vm_start) >> PAGE_SHIFT;
 			nid = offset_il_node(pol, vma, off);
 		} else {
 			/* fall back to process interleaving */