summaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-09-13 23:07:18 +0200
committerPaul Mackerras <paulus@samba.org>2006-09-13 23:07:18 +0200
commitc547fc28ab3e8716076fdaf4bd0260c5d63a18f7 (patch)
tree34af1fa64a63618660187ae58ad182665a1861ef /mm/mempolicy.c
parent[POWERPC] Export copy_4K_page() (diff)
parentMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/... (diff)
downloadlinux-c547fc28ab3e8716076fdaf4bd0260c5d63a18f7.tar.xz
linux-c547fc28ab3e8716076fdaf4bd0260c5d63a18f7.zip
Merge branch 'linux-2.6'
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index e07e27e846a2..a9963ceddd65 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1176,7 +1176,15 @@ static inline unsigned interleave_nid(struct mempolicy *pol,
if (vma) {
unsigned long off;
- off = vma->vm_pgoff;
+ /*
+ * for small pages, there is no difference between
+ * shift and PAGE_SHIFT, so the bit-shift is safe.
+ * for huge pages, since vm_pgoff is in units of small
+ * pages, we need to shift off the always 0 bits to get
+ * a useful offset.
+ */
+ BUG_ON(shift < PAGE_SHIFT);
+ off = vma->vm_pgoff >> (shift - PAGE_SHIFT);
off += (addr - vma->vm_start) >> shift;
return offset_il_node(pol, vma, off);
} else