From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linux Memory Management <linux-mm@kvack.org>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC/PATCH 7/12] ia64 tracks freed page tables addresses
Date: Tue, 07 Aug 2007 17:19:50 +1000 [thread overview]
Message-ID: <20070807071957.763E0DDDFA@ozlabs.org> (raw)
In-Reply-To: <1186471185.826251.312410898174.qpush@grosgo>
Until now, ia64 pretty much relied on the start/end arguments
passed to tlb_finish_mmu() to flush the virtual page tables.
Not only these tend to provide larger ranges than necessary,
but keeping track in the callers is a pain and I intend to remove
those from my mmu_gather rework.
This patch uses the newly added "address" arguemnt to pte_free_tlb()
to track the actual range covered by freed page tables and uses
that to perform the actual freeing.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
include/asm-ia64/tlb.h | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
Index: linux-work/include/asm-ia64/tlb.h
===================================================================
--- linux-work.orig/include/asm-ia64/tlb.h 2007-08-06 16:15:18.000000000 +1000
+++ linux-work/include/asm-ia64/tlb.h 2007-08-06 16:15:18.000000000 +1000
@@ -61,6 +61,8 @@ struct mmu_gather {
unsigned char need_flush; /* really unmapped some PTEs? */
unsigned long start_addr;
unsigned long end_addr;
+ unsigned long start_pgtable;
+ unsigned long end_pgtable;
struct page *pages[FREE_PTE_NR];
};
@@ -72,8 +74,10 @@ DECLARE_PER_CPU(struct mmu_gather, mmu_g
* freed pages that where gathered up to this point.
*/
static inline void
-ia64_tlb_flush_mmu (struct mmu_gather *tlb, unsigned long start, unsigned long end)
+ia64_tlb_flush_mmu (struct mmu_gather *tlb)
{
+ unsigned long start = tlb->start_addr;
+ unsigned long end = tlb->end_addr;
unsigned int nr;
if (!tlb->need_flush)
@@ -107,7 +111,10 @@ ia64_tlb_flush_mmu (struct mmu_gather *t
/* flush the address range from the tlb: */
flush_tlb_range(&vma, start, end);
/* now flush the virt. page-table area mapping the address range: */
- flush_tlb_range(&vma, ia64_thash(start), ia64_thash(end));
+ if (tlb->start_pgtable < tlb->end_pgtable)
+ flush_tlb_range(&vma,
+ ia64_thash(tlb->start_pgtable),
+ ia64_thash(tlb->end_pgtable));
}
/* lastly, release the freed pages */
@@ -115,7 +122,7 @@ ia64_tlb_flush_mmu (struct mmu_gather *t
if (!tlb_fast_mode(tlb)) {
unsigned long i;
tlb->nr = 0;
- tlb->start_addr = ~0UL;
+ tlb->start_addr = tlb->start_pgtable = ~0UL;
for (i = 0; i < nr; ++i)
free_page_and_swap_cache(tlb->pages[i]);
}
@@ -145,7 +152,7 @@ tlb_gather_mmu (struct mm_struct *mm, un
*/
tlb->nr = (num_online_cpus() == 1) ? ~0U : 0;
tlb->fullmm = full_mm_flush;
- tlb->start_addr = ~0UL;
+ tlb->start_addr = tlb->start_pgtable = ~0UL;
return tlb;
}
@@ -160,7 +167,7 @@ tlb_finish_mmu (struct mmu_gather *tlb,
* Note: tlb->nr may be 0 at this point, so we can't rely on tlb->start_addr and
* tlb->end_addr.
*/
- ia64_tlb_flush_mmu(tlb, start, end);
+ ia64_tlb_flush_mmu(tlb);
/* keep the page table cache within bounds */
check_pgt_cache();
@@ -184,7 +191,7 @@ tlb_remove_page (struct mmu_gather *tlb,
}
tlb->pages[tlb->nr++] = page;
if (tlb->nr >= FREE_PTE_NR)
- ia64_tlb_flush_mmu(tlb, tlb->start_addr, tlb->end_addr);
+ ia64_tlb_flush_mmu(tlb);
}
/*
@@ -194,7 +201,7 @@ tlb_remove_page (struct mmu_gather *tlb,
static inline void
__tlb_remove_tlb_entry (struct mmu_gather *tlb, pte_t *ptep, unsigned long address)
{
- if (tlb->start_addr == ~0UL)
+ if (tlb->start_addr > address)
tlb->start_addr = address;
tlb->end_addr = address + PAGE_SIZE;
}
@@ -213,6 +220,9 @@ do { \
#define pte_free_tlb(tlb, ptep, addr) \
do { \
tlb->need_flush = 1; \
+ if (tlb->start_pgtable > addr) \
+ tlb->start_pgtable = addr; \
+ tlb->end_pgtable = (addr + PMD_SIZE) & PMD_MASK;\
__pte_free_tlb(tlb, ptep, addr); \
} while (0)
--
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:[~2007-08-07 7:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 7:19 [RFC/PATCH 0/12] WIP mmu_gather and PTE accessors work Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 1/12] remove frv usage of flush_tlb_pgtables() Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 2/12] remove flush_tlb_pgtables Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 3/12] Add MMF_DEAD flag to mm_struct being torn down Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 4/12] disconnect sparc64 tlb flush from mmu_gather Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 6/12] Add "address" argument to pte/pmd/pud_free_tlb() Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 5/12] Add mm argument to pte/pmd/pud/pgd_free Benjamin Herrenschmidt
2007-08-07 7:19 ` Benjamin Herrenschmidt [this message]
2007-08-07 7:19 ` [RFC/PATCH 8/12] remove ptep_get_and_clear_full Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 9/12] mmu_gather on stack, part 1 Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 11/12] Use mmu_gather for fork() instead of flush_tlb_mm() Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 10/12] remove call to flush_tlb_page() from handle_pte_fault() Benjamin Herrenschmidt
2007-08-07 7:19 ` [RFC/PATCH 12/12] Use mmu_gather for fs/proc/task_mmu.c 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=20070807071957.763E0DDDFA@ozlabs.org \
--to=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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