public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Greg KH <greg@kroah.com>
Cc: Hugh Dickins <hugh@veritas.com>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: kernel BUG at mm/rmap.c:480 in 2.6.10-rc3-bk7
Date: Wed, 15 Dec 2004 20:03:43 +0100	[thread overview]
Message-ID: <20041215190343.GI16322@dualathlon.random> (raw)
In-Reply-To: <20041215175805.GA9207@kroah.com>

This was my original code in GA/SP1:

#ifndef CONFIG_DISCONTIGMEM
	/* this check is unreliable with numa enabled */
	BUG_ON(!pfn_valid(page_to_pfn(new_page)));
#endif
	pageable = !PageReserved(new_page);
	as = !!new_page->mapping;

	BUG_ON(!pageable && as);

	pageable &= as;

	/* ->nopage cannot return swapcache */
	BUG_ON(PageSwapCache(new_page));
	/* ->nopage cannot return anonymous pages */
	BUG_ON(PageAnon(new_page));

[..]

		/* a reserved vma cannot have pageable pages in it */
		BUG_ON(vma->vm_flags & VM_RESERVED);
[..]
	if (likely(pageable))
			page_add_rmap(new_page, vma, address, anon);




Hugh rejected all the above robustness bugcheck for no apparent good
reason.

In the process he seems that Hugh introduced a bug that didn't exist in
my original code, can you try this?

From: Andrea Arcangeli <andrea@suse.de>
Subject: don't track pages not belonging to a mapping out of ->nopage

Signed-off-by: Andrea Arcangeli <andrea@suse.de>

--- sl9.2/mm/memory.c.~1~	2004-12-15 14:20:54.000000000 +0100
+++ sl9.2/mm/memory.c	2004-12-15 19:59:59.806978776 +0100
@@ -427,7 +427,8 @@ static void zap_pte_range(struct mmu_gat
 			if (pte_young(pte) && !PageAnon(page))
 				mark_page_accessed(page);
 			tlb->freed++;
-			page_remove_rmap(page);
+			if (page->mapping)
+				page_remove_rmap(page);
 			tlb_remove_page(tlb, page);
 			continue;
 		}
@@ -1495,7 +1496,7 @@ do_no_page(struct mm_struct *mm, struct 
 	pte_t entry;
 	int sequence = 0;
 	int ret = VM_FAULT_MINOR;
-	int anon = 0;
+	int anon, pageable, as;
 
 	if (!vma->vm_ops || !vma->vm_ops->nopage)
 		return do_anonymous_page(mm, vma, page_table,
@@ -1517,9 +1518,26 @@ retry:
 	if (new_page == NOPAGE_OOM)
 		return VM_FAULT_OOM;
 
+#ifndef CONFIG_DISCONTIGMEM
+	/* this check is unreliable with numa enabled */
+	BUG_ON(!pfn_valid(page_to_pfn(new_page)));
+#endif
+	pageable = !PageReserved(new_page);
+	as = !!new_page->mapping;
+
+	BUG_ON(!pageable && as);
+
+	pageable &= as;
+
+	/* ->nopage cannot return swapcache */
+	BUG_ON(PageSwapCache(new_page));
+	/* ->nopage cannot return anonymous pages */
+	BUG_ON(PageAnon(new_page));
+
 	/*
 	 * Should we do an early C-O-W break?
 	 */
+	anon = 0;
 	if (write_access && !(vma->vm_flags & VM_SHARED)) {
 		struct page *page;
 
@@ -1532,6 +1550,10 @@ retry:
 		page_cache_release(new_page);
 		new_page = page;
 		anon = 1;
+		pageable = 1; /* not really necessary but cleaner */
+
+		/* a reserved vma cannot have pageable pages in it */
+		BUG_ON(vma->vm_flags & VM_RESERVED);
 	}
 
 	spin_lock(&mm->page_table_lock);
@@ -1571,7 +1593,7 @@ retry:
 		if (anon) {
 			lru_cache_add_active(new_page);
 			page_add_anon_rmap(new_page, vma, address);
-		} else
+		} else if (pageable)
 			page_add_file_rmap(new_page);
 		pte_unmap(page_table);
 	} else {

  parent reply	other threads:[~2004-12-15 19:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-14 16:45 kernel BUG at mm/rmap.c:480 in 2.6.10-rc3-bk7 Greg KH
2004-12-14 23:26 ` Hugh Dickins
2004-12-15  0:10   ` Nick Piggin
2004-12-15  0:19   ` Greg KH
2004-12-15  1:11     ` Greg KH
2004-12-15 17:23       ` Hugh Dickins
2004-12-15 17:58         ` Greg KH
2004-12-15 18:48           ` Hugh Dickins
2004-12-15 22:22             ` Hugh Dickins
2004-12-15 22:33             ` Dave Airlie
2004-12-15 23:19               ` Greg KH
2004-12-15 19:03           ` Andrea Arcangeli [this message]
2004-12-15 22:48             ` Andrea Arcangeli
2004-12-15 23:41               ` Greg KH
2004-12-16  5:18                 ` Hugh Dickins
2004-12-16 14:28                   ` Andrea Arcangeli
2004-12-16 17:03                     ` Hugh Dickins
2004-12-15  0:43   ` Andrea Arcangeli

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=20041215190343.GI16322@dualathlon.random \
    --to=andrea@suse.de \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox