From: Christoph Lameter <clameter@engr.sgi.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@osdl.org>,
torvalds@osdl.org, piggin@yahoo.com.au, linux-mm@kvack.org
Subject: [PATCH] use mm_counter macros for nr_pte since its also under ptl
Date: Thu, 18 Aug 2005 18:22:21 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.62.0508181818100.2740@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0508182116110.11409@goblin.wat.veritas.com>
On Thu, 18 Aug 2005, Hugh Dickins wrote:
> they went into -mm. Proof: if that's what you're testing, you very
> soon hit the BUG_ON(mm->nr_ptes...) at the end of exit_mmap. And
> once you've worked your way through the architectural maze, you
> realize that nr_ptes used to be protected by page_table_lock but
> is currently unprotected when CONFIG_ATOMIC_TABLE_OPS. (I fixed
> that here by adding back page_table_lock around it, but Christoph
> will probably prefer to go atomic with it; for people just testing
> the scalability, it's okay to remove that BUG_ON for the moment.)
Ah thanks.
Actually this is a bug already present in Linus' tree (but still my
fault). nr_pte's needs to be managed through the mm counter macros like
other counters protected by the page table fault.
This is a patch against Linus' current tree and independent of the page
fault scalability patches.
---
Make nr_pte a mm_counter.
nr_pte is also protected by the page_table_lock like rss and anon_rss. This patch
changes all accesses to nr_pte to use the macros provided for that purpose.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.13-rc6/include/linux/sched.h
===================================================================
--- linux-2.6.13-rc6.orig/include/linux/sched.h 2005-08-07 11:18:56.000000000 -0700
+++ linux-2.6.13-rc6/include/linux/sched.h 2005-08-18 18:10:28.000000000 -0700
@@ -238,9 +238,10 @@ struct mm_struct {
unsigned long start_brk, brk, start_stack;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long total_vm, locked_vm, shared_vm;
- unsigned long exec_vm, stack_vm, reserved_vm, def_flags, nr_ptes;
+ unsigned long exec_vm, stack_vm, reserved_vm, def_flags;
/* Special counters protected by the page_table_lock */
+ mm_counter_t _nr_ptes;
mm_counter_t _rss;
mm_counter_t _anon_rss;
Index: linux-2.6.13-rc6/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.13-rc6.orig/fs/proc/task_mmu.c 2005-08-07 11:18:56.000000000 -0700
+++ linux-2.6.13-rc6/fs/proc/task_mmu.c 2005-08-18 18:10:28.000000000 -0700
@@ -27,7 +27,7 @@ char *task_mem(struct mm_struct *mm, cha
get_mm_counter(mm, rss) << (PAGE_SHIFT-10),
data << (PAGE_SHIFT-10),
mm->stack_vm << (PAGE_SHIFT-10), text, lib,
- (PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10);
+ (PTRS_PER_PTE*sizeof(pte_t)*get_mm_counter(mm, nr_ptes)) >> 10);
return buffer;
}
Index: linux-2.6.13-rc6/kernel/fork.c
===================================================================
--- linux-2.6.13-rc6.orig/kernel/fork.c 2005-08-07 11:18:56.000000000 -0700
+++ linux-2.6.13-rc6/kernel/fork.c 2005-08-18 18:10:28.000000000 -0700
@@ -320,7 +320,7 @@ static struct mm_struct * mm_init(struct
init_rwsem(&mm->mmap_sem);
INIT_LIST_HEAD(&mm->mmlist);
mm->core_waiters = 0;
- mm->nr_ptes = 0;
+ set_mm_counter(mm, nr_ptes, 0);
spin_lock_init(&mm->page_table_lock);
rwlock_init(&mm->ioctx_list_lock);
mm->ioctx_list = NULL;
Index: linux-2.6.13-rc6/mm/memory.c
===================================================================
--- linux-2.6.13-rc6.orig/mm/memory.c 2005-08-07 11:18:56.000000000 -0700
+++ linux-2.6.13-rc6/mm/memory.c 2005-08-18 18:10:28.000000000 -0700
@@ -116,7 +116,7 @@ static void free_pte_range(struct mmu_ga
pmd_clear(pmd);
pte_free_tlb(tlb, page);
dec_page_state(nr_page_table_pages);
- tlb->mm->nr_ptes--;
+ dec_mm_counter(tlb->mm, nr_ptes);
}
static inline void free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
@@ -299,7 +299,7 @@ pte_t fastcall *pte_alloc_map(struct mm_
pte_free(new);
goto out;
}
- mm->nr_ptes++;
+ inc_mm_counter(mm, nr_ptes);
inc_page_state(nr_page_table_pages);
pmd_populate(mm, pmd, new);
}
Index: linux-2.6.13-rc6/mm/mmap.c
===================================================================
--- linux-2.6.13-rc6.orig/mm/mmap.c 2005-08-07 11:18:56.000000000 -0700
+++ linux-2.6.13-rc6/mm/mmap.c 2005-08-18 18:10:28.000000000 -0700
@@ -1969,7 +1969,7 @@ void exit_mmap(struct mm_struct *mm)
vma = next;
}
- BUG_ON(mm->nr_ptes > (FIRST_USER_ADDRESS+PMD_SIZE-1)>>PMD_SHIFT);
+ BUG_ON(get_mm_counter(mm, nr_ptes) > (FIRST_USER_ADDRESS+PMD_SIZE-1)>>PMD_SHIFT);
}
/* Insert vm structure into process list sorted by address
Index: linux-2.6.13-rc6/arch/um/kernel/skas/mmu.c
===================================================================
--- linux-2.6.13-rc6.orig/arch/um/kernel/skas/mmu.c 2005-08-07 11:18:56.000000000 -0700
+++ linux-2.6.13-rc6/arch/um/kernel/skas/mmu.c 2005-08-18 18:10:28.000000000 -0700
@@ -115,7 +115,7 @@ int init_new_context_skas(struct task_st
if(ret)
goto out_free;
- mm->nr_ptes--;
+ dec_mm_counter(mm, nr_ptes);
if((cur_mm != NULL) && (cur_mm != &init_mm))
mm_id->u.pid = copy_context_skas0(stack,
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2005-08-19 1:22 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-17 22:17 pagefault scalability patches Andrew Morton
2005-08-17 22:19 ` Christoph Lameter
2005-08-17 22:36 ` Linus Torvalds
2005-08-17 22:51 ` Christoph Lameter
2005-08-17 23:01 ` Linus Torvalds
2005-08-17 23:12 ` Christoph Lameter
2005-08-17 23:23 ` Linus Torvalds
2005-08-17 23:31 ` Christoph Lameter
2005-08-17 23:30 ` Andrew Morton
2005-08-17 23:33 ` Christoph Lameter
2005-08-17 23:44 ` Andrew Morton
2005-08-17 23:52 ` Peter Chubb
2005-08-17 23:58 ` Christoph Lameter
2005-08-18 0:47 ` Andrew Morton
2005-08-18 16:09 ` Christoph Lameter
2005-08-22 2:13 ` Benjamin Herrenschmidt
2005-08-18 0:43 ` Andrew Morton
2005-08-18 16:04 ` Christoph Lameter
2005-08-18 20:16 ` Hugh Dickins
2005-08-19 1:22 ` Christoph Lameter [this message]
2005-08-19 3:17 ` [PATCH] use mm_counter macros for nr_pte since its also under ptl Andrew Morton
2005-08-19 3:51 ` Christoph Lameter
2005-08-19 1:33 ` pagefault scalability patches Christoph Lameter
2005-08-19 3:53 ` [RFC] Concept for delayed counter updates in mm_struct Christoph Lameter
2005-08-19 4:29 ` Andrew Morton
2005-08-19 4:34 ` Andi Kleen
2005-08-19 4:49 ` Linus Torvalds
2005-08-19 16:06 ` Christoph Lameter
2005-08-20 7:33 ` [PATCH] mm_struct counter deltas in task_struct Christoph Lameter
2005-08-20 7:35 ` [PATCH] Use deltas to replace atomic inc Christoph Lameter
2005-08-20 7:58 ` Andrew Morton
2005-08-22 3:32 ` Christoph Lameter
2005-08-22 3:48 ` Linus Torvalds
2005-08-22 4:06 ` Christoph Lameter
2005-08-22 4:18 ` Linus Torvalds
2005-08-22 13:23 ` Christoph Lameter
2005-08-22 14:22 ` Hugh Dickins
2005-08-22 15:24 ` Christoph Lameter
2005-08-22 15:43 ` Andi Kleen
2005-08-22 16:24 ` Christoph Lameter
2005-08-22 20:30 ` [PATCH] mm_struct counter deltas V2 Christoph Lameter
2005-08-22 20:31 ` [PATCH] Use deltas to replace atomic inc V2 Christoph Lameter
2005-08-22 2:09 ` pagefault scalability patches Benjamin Herrenschmidt
2005-08-18 2:00 ` Nick Piggin
2005-08-18 8:38 ` Nick Piggin
2005-08-18 16:17 ` Christoph Lameter
2005-08-22 2:04 ` Benjamin Herrenschmidt
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=Pine.LNX.4.62.0508181818100.2740@schroedinger.engr.sgi.com \
--to=clameter@engr.sgi.com \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=piggin@yahoo.com.au \
--cc=torvalds@osdl.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