use linear_page_index() in mm/mempolicy.c

From: William Lee Irwin III
Date: Thu Aug 12 2004 - 21:38:05 EST


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.


Index: spinlock-2.6.8-rc4/mm/mempolicy.c
===================================================================
--- spinlock-2.6.8-rc4.orig/mm/mempolicy.c 2004-08-10 23:00:25.101832328 -0700
+++ spinlock-2.6.8-rc4/mm/mempolicy.c 2004-08-12 19:20:41.784408232 -0700
@@ -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 */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/