All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Andrew Morton <akpm@osdl.org>
Cc: William Lee Irwin <wli@holomorphy.com>,
	Andy Whitworth <apw@shadowen.org>,
	Anton Blanchard <anton@samba.org>,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@suse.de>,
	linuxppc64-dev@lists.linuxppc.org
Subject: Yet another hugepage bug
Date: Wed, 2 Jun 2004 17:37:42 +1000	[thread overview]
Message-ID: <20040602073742.GA3673@zax> (raw)

Andrew, please apply

Currently, calling msync() on a hugepage area will cause the kernel to
blow up with a bad_page() (at least on ppc64, but I think the problem
will exist on other archs too).  The msync path attempts to walk
pagetables which may not be there, or may have an unusual layout for
hugepages.

Lucikly we shouldn't need to do anything for an msync on hugetlbfs
beyond flushing the cache, so this patch should be sufficient to fix
the problem.

Index: working-2.6/mm/msync.c
===================================================================
--- working-2.6.orig/mm/msync.c	2004-05-20 12:59:04.000000000 +1000
+++ working-2.6/mm/msync.c	2004-06-02 17:33:50.775695368 +1000
@@ -11,6 +11,7 @@
 #include <linux/pagemap.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
+#include <linux/hugetlb.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -106,6 +107,13 @@
 
 	dir = pgd_offset(vma->vm_mm, address);
 	flush_cache_range(vma, address, end);
+
+	/* For hugepages we can't go walking the page table normally,
+	 * but that's ok, hugetlbfs is memory based, so we don't need
+	 * to do anything more on an msync() */
+	if (is_vm_hugetlb_page(vma))
+		goto out;
+
 	if (address >= end)
 		BUG();
 	do {
@@ -118,7 +126,7 @@
 	 * dirty bits.
 	 */
 	flush_tlb_range(vma, end - size, end);
-
+ out:
 	spin_unlock(&vma->vm_mm->page_table_lock);
 
 	return error;


-- 
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

                 reply	other threads:[~2004-06-02  7:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040602073742.GA3673@zax \
    --to=david@gibson.dropbear.id.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=anton@samba.org \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@lists.linuxppc.org \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.