public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: Hugh Dickins <hugh@veritas.com>,
	davem@davemloft.net, tony.luck@intel.com,
	benh@kernel.crashing.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] freepgt: free_pgtables use vma list
Date: Tue, 22 Mar 2005 23:17:21 +1100	[thread overview]
Message-ID: <42400CD1.10101@yahoo.com.au> (raw)
In-Reply-To: <20050322034053.311b10e6.akpm@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Andrew Morton wrote:
> With these six patches the ppc64 is hitting the BUG in exit_mmap():
> 
>         BUG_ON(mm->nr_ptes);    /* This is just debugging */
> 
> fairly early in boot.
> 

No doubt Hugh will have this fixed before long... but if you
have time to spare, you may just try hitting it on the head
and making it a bit dumber. It might help show where the problem
is.

- don't span multiple vmas
- don't be so smart about avoiding unfreeable regions

I dunno. Maybe it won't help at all. Maybe it will make things
worse :P



[-- Attachment #2: ptclr-nosmart.patch --]
[-- Type: text/plain, Size: 2267 bytes --]

Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c	2005-03-22 23:04:34.000000000 +1100
+++ linux-2.6/mm/memory.c	2005-03-22 23:11:31.000000000 +1100
@@ -110,13 +110,18 @@ void pmd_clear_bad(pmd_t *pmd)
  * Note: this doesn't free the actual pages themselves. That
  * has been handled earlier when unmapping all the memory regions.
  */
-static void free_pte_range(struct mmu_gather *tlb, pmd_t *pmd)
+static void free_pte_range(struct mmu_gather *tlb, pmd_t *pmd,
+				unsigned long addr, unsigned long end,
+				unsigned long floor, unsigned long ceiling)
 {
-	struct page *page = pmd_page(*pmd);
-	pmd_clear(pmd);
-	pte_free_tlb(tlb, page);
-	dec_page_state(nr_page_table_pages);
-	tlb->mm->nr_ptes--;
+	if (((addr & PMD_MASK) >= floor)
+			&& (end - 1 <= (ceiling & PMD_MASK) - 1)) {
+		struct page *page = pmd_page(*pmd);
+		pmd_clear(pmd);
+		pte_free_tlb(tlb, page);
+		dec_page_state(nr_page_table_pages);
+		tlb->mm->nr_ptes--;
+	}
 }
 
 static inline void free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
@@ -133,7 +138,7 @@ static inline void free_pmd_range(struct
 		next = pmd_addr_end(addr, end);
 		if (pmd_none_or_clear_bad(pmd))
 			continue;
-		free_pte_range(tlb, pmd);
+		free_pte_range(tlb, pmd, addr, end, floor, ceiling);
 	} while (pmd++, addr = next, addr != end);
 
 	start &= PUD_MASK;
@@ -190,18 +195,6 @@ void free_pgd_range(struct mmu_gather **
 	unsigned long next;
 	unsigned long start;
 
-	addr &= PMD_MASK;
-	if (addr < floor) {
-		addr += PMD_SIZE;
-		if (!addr)
-			return;
-	}
-	ceiling &= PMD_MASK;
-	if (end - 1 > ceiling - 1)
-		end -= PMD_SIZE;
-	if (addr > end - 1)
-		return;
-
 	start = addr;
 	pgd = pgd_offset((*tlb)->mm, addr);
 	do {
@@ -226,14 +219,6 @@ void free_pgtables(struct mmu_gather **t
 			hugetlb_free_pgd_range(tlb, addr, vma->vm_end,
 				floor, next? next->vm_start: ceiling);
 		} else {
-			/*
-			 * Optimization: gather nearby vmas into one call down
-			 */
-			while (next && next->vm_start <= vma->vm_end + PMD_SIZE
-			&& !is_hugepage_only_range(next->vm_start, HPAGE_SIZE)){
-				vma = next;
-				next = vma->vm_next;
-			}
 			free_pgd_range(tlb, addr, vma->vm_end,
 				floor, next? next->vm_start: ceiling);
 		}

  reply	other threads:[~2005-03-22 12:17 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21 20:52 [PATCH 1/5] freepgt: free_pgtables use vma list Hugh Dickins
2005-03-21 20:55 ` [PATCH 2/5] freepgt: remove MM_VM_SIZE(mm) Hugh Dickins
2005-03-21 20:56 ` [PATCH 3/5] freepgt: hugetlb_free_pgd_range Hugh Dickins
2005-03-21 20:57 ` [PATCH 4/5] freepgt: remove arch pgd_addr_end Hugh Dickins
2005-03-21 20:58 ` [PATCH 5/5] freepgt: mpnt to vma cleanup Hugh Dickins
2005-03-21 22:26 ` [PATCH 1/5] freepgt: free_pgtables use vma list David S. Miller
2005-03-22  5:47   ` Hugh Dickins
2005-03-22 17:41     ` David S. Miller
2005-03-22 11:40 ` Andrew Morton
2005-03-22 12:17   ` Nick Piggin [this message]
2005-03-22 16:37   ` Hugh Dickins
2005-03-22 18:34     ` David S. Miller
2005-03-22 19:01     ` David S. Miller
2005-03-22 19:21       ` David S. Miller
2005-03-22 19:23         ` David S. Miller
2005-03-22 19:36           ` Hugh Dickins
2005-03-22 20:21             ` David S. Miller
2005-03-22 23:45               ` Benjamin Herrenschmidt
2005-03-22 20:33             ` David S. Miller
2005-03-22 21:51               ` Hugh Dickins
2005-03-22 22:41                 ` David S. Miller
2005-03-23  0:51                   ` Hugh Dickins
2005-03-23  2:09                     ` David S. Miller
2005-03-22 23:32                 ` Nick Piggin
2005-03-22 23:44                   ` David S. Miller
2005-03-23  0:19                     ` Nick Piggin
2005-03-23  0:20                       ` David S. Miller
2005-03-23  0:00                   ` David S. Miller
2005-03-23  0:03                   ` David S. Miller
2005-03-22 21:28             ` David S. Miller
2005-03-22 23:30     ` Benjamin Herrenschmidt
2005-03-23 13:28       ` Hugh Dickins
2005-03-23 23:07         ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2005-03-21 22:31 Luck, Tony
2005-03-21 23:02 ` David S. Miller
2005-03-22  4:14   ` Nick Piggin
2005-03-22  5:29     ` David S. Miller
2005-03-22  6:08       ` Hugh Dickins
2005-03-22  6:33         ` Nick Piggin
2005-03-22 17:52         ` David S. Miller
2005-03-22 17:55     ` David S. Miller
2005-03-22  5:42   ` Hugh Dickins
2005-03-22 18:06 Luck, Tony
2005-03-22 18:48 ` Hugh Dickins
2005-03-22 22:40 Luck, Tony
2005-03-22 23:30 ` David S. Miller
2005-03-23  0:40 ` Hugh Dickins
2005-03-22 23:53 Luck, Tony
2005-03-22 23:56 ` David S. Miller
2005-03-23  0:56 ` Hugh Dickins
2005-03-23  1:10   ` Andrew Morton
2005-03-23  2:00     ` David S. Miller
2005-03-23  2:10       ` Nick Piggin
2005-03-23  2:15         ` David S. Miller

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=42400CD1.10101@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox