From: steiner@sgi.com
To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [Patch 02/25] GRU - skip gru tlb purging of gru contexts:w
Date: Thu, 26 Aug 2010 08:19:39 -0500 [thread overview]
Message-ID: <20100826132123.311733838@sgi.com> (raw)
In-Reply-To: 20100826131937.108920216@sgi.com
[-- Attachment #1: uv_gru_no_tlb_purge_gseg --]
[-- Type: text/plain, Size: 5566 bytes --]
From: Jack Steiner <steiner@sgi.com>
Skip purging the GRU TLB if the purge request is for the GRU
itself. The driver will not create TLB mappings for vmas
that map the GRU address space. Purging them is unnecessary.
This is only an optimization and is not functionally required. However, if
GRU resources are oversubscribed (unusual except for stress tests),
purging can be frequent.
Signed-off-by: Jack Steiner <steiner@sgi.com>
---
drivers/misc/sgi-gru/grufault.c | 8 ++++----
drivers/misc/sgi-gru/grufile.c | 2 +-
drivers/misc/sgi-gru/gruprocfs.c | 1 +
drivers/misc/sgi-gru/grutables.h | 3 ++-
drivers/misc/sgi-gru/grutlbpurge.c | 11 +++++++++--
5 files changed, 17 insertions(+), 8 deletions(-)
Index: linux/drivers/misc/sgi-gru/grufault.c
===================================================================
--- linux.orig/drivers/misc/sgi-gru/grufault.c 2010-06-09 08:11:31.480037430 -0500
+++ linux/drivers/misc/sgi-gru/grufault.c 2010-06-09 08:11:39.747460083 -0500
@@ -57,11 +57,11 @@ static inline int is_gru_paddr(unsigned
/*
* Find the vma of a GRU segment. Caller must hold mmap_sem.
*/
-struct vm_area_struct *gru_find_vma(unsigned long vaddr)
+struct vm_area_struct *gru_find_vma(struct mm_struct *mm, unsigned long vaddr)
{
struct vm_area_struct *vma;
- vma = find_vma(current->mm, vaddr);
+ vma = find_vma(mm, vaddr);
if (vma && vma->vm_start <= vaddr && vma->vm_ops == &gru_vm_ops)
return vma;
return NULL;
@@ -82,7 +82,7 @@ static struct gru_thread_state *gru_find
struct gru_thread_state *gts = NULL;
down_read(&mm->mmap_sem);
- vma = gru_find_vma(vaddr);
+ vma = gru_find_vma(current->mm, vaddr);
if (vma)
gts = gru_find_thread_state(vma, TSID(vaddr, vma));
if (gts)
@@ -99,7 +99,7 @@ static struct gru_thread_state *gru_allo
struct gru_thread_state *gts = ERR_PTR(-EINVAL);
down_write(&mm->mmap_sem);
- vma = gru_find_vma(vaddr);
+ vma = gru_find_vma(current->mm, vaddr);
if (!vma)
goto err;
Index: linux/drivers/misc/sgi-gru/grufile.c
===================================================================
--- linux.orig/drivers/misc/sgi-gru/grufile.c 2010-06-09 08:11:31.480037430 -0500
+++ linux/drivers/misc/sgi-gru/grufile.c 2010-06-09 08:11:39.751457793 -0500
@@ -145,7 +145,7 @@ static int gru_create_new_context(unsign
req.options |= GRU_OPT_MISS_FMM_INTR;
down_write(¤t->mm->mmap_sem);
- vma = gru_find_vma(req.gseg);
+ vma = gru_find_vma(current->mm, req.gseg);
if (vma) {
vdata = vma->vm_private_data;
vdata->vd_user_options = req.options;
Index: linux/drivers/misc/sgi-gru/gruprocfs.c
===================================================================
--- linux.orig/drivers/misc/sgi-gru/gruprocfs.c 2010-06-09 08:11:31.480037430 -0500
+++ linux/drivers/misc/sgi-gru/gruprocfs.c 2010-06-09 08:11:39.763413322 -0500
@@ -87,6 +87,7 @@ static int statistics_show(struct seq_fi
printstat(s, tlb_dropin_fail_no_exception);
printstat(s, tfh_stale_on_fault);
printstat(s, mmu_invalidate_range);
+ printstat(s, mmu_invalidate_range_flush);
printstat(s, mmu_invalidate_page);
printstat(s, flush_tlb);
printstat(s, flush_tlb_gru);
Index: linux/drivers/misc/sgi-gru/grutables.h
===================================================================
--- linux.orig/drivers/misc/sgi-gru/grutables.h 2010-06-09 08:11:31.480037430 -0500
+++ linux/drivers/misc/sgi-gru/grutables.h 2010-06-09 08:11:39.779413278 -0500
@@ -213,6 +213,7 @@ struct gru_stats_s {
atomic_long_t tlb_dropin_fail_no_exception;
atomic_long_t tfh_stale_on_fault;
atomic_long_t mmu_invalidate_range;
+ atomic_long_t mmu_invalidate_range_flush;
atomic_long_t mmu_invalidate_page;
atomic_long_t flush_tlb;
atomic_long_t flush_tlb_gru;
@@ -653,7 +654,7 @@ extern int gru_get_exception_detail(unsi
extern int gru_set_context_option(unsigned long address);
extern void gru_check_context_placement(struct gru_thread_state *gts);
extern int gru_cpu_fault_map_id(void);
-extern struct vm_area_struct *gru_find_vma(unsigned long vaddr);
+extern struct vm_area_struct *gru_find_vma(struct mm_struct *mm, unsigned long vaddr);
extern void gru_flush_all_tlb(struct gru_state *gru);
extern int gru_proc_init(void);
extern void gru_proc_exit(void);
Index: linux/drivers/misc/sgi-gru/grutlbpurge.c
===================================================================
--- linux.orig/drivers/misc/sgi-gru/grutlbpurge.c 2010-06-09 08:11:31.480037430 -0500
+++ linux/drivers/misc/sgi-gru/grutlbpurge.c 2010-06-09 08:11:39.795536964 -0500
@@ -226,11 +226,19 @@ static void gru_invalidate_range_start(s
struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
ms_notifier);
+ if (mm && atomic_read(&mm->mm_users) && unlikely(down_write_trylock(&mm->mmap_sem))) {
+ up_write(&mm->mmap_sem);
+ }
STAT(mmu_invalidate_range);
atomic_inc(&gms->ms_range_active);
gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx, act %d\n", gms,
start, end, atomic_read(&gms->ms_range_active));
- gru_flush_tlb_range(gms, start, end - start);
+
+ /* No need to flush if unmapping a GRU context */
+ if (!gru_find_vma(mm, start)) {
+ STAT(mmu_invalidate_range_flush);
+ gru_flush_tlb_range(gms, start, end - start);
+ }
}
static void gru_invalidate_range_end(struct mmu_notifier *mn,
@@ -242,7 +250,6 @@ static void gru_invalidate_range_end(str
/* ..._and_test() provides needed barrier */
(void)atomic_dec_and_test(&gms->ms_range_active);
-
wake_up_all(&gms->ms_wait_queue);
gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx\n", gms, start, end);
}
next prev parent reply other threads:[~2010-08-26 13:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-26 13:19 [Patch 00/25] GRU - GRU Updates - Production Driver steiner
2010-08-26 13:19 ` [Patch 01/25] GRU - delete obsolete gru instruction opcodes steiner
2010-08-26 13:19 ` steiner [this message]
2010-08-26 13:19 ` [Patch 03/25] GRU - update gru tlb miss statistics steiner
2010-08-26 13:19 ` [Patch 04/25] GRU - mmap gru contexts using nonlinear steiner
2010-08-26 13:19 ` [Patch 05/25] GRU - cbe cache flush steiner
2010-08-26 13:19 ` [Patch 06/25] GRU - change context stealing steiner
2010-08-26 13:19 ` [Patch 07/25] GRU - add context lock flag to gru status steiner
2010-08-26 13:19 ` [Patch 08/25] GRU - flush gru tlb when driver is loaded steiner
2010-08-26 13:19 ` [Patch 09/25] GRU - add software reserved bits to cbr definition steiner
2010-08-26 13:19 ` [Patch 10/25] GRU - eliminate gru contention on mmap_sem steiner
2010-08-26 13:19 ` [Patch 11/25] GRU - interrupt fix for processors without core 0 steiner
2010-08-26 13:19 ` [Patch 12/25] GRU - add gru hub number to context status steiner
2010-08-26 13:19 ` [Patch 13/25] GRU - delete obsolete debug code steiner
2010-08-26 13:19 ` [Patch 14/25] GRU - add polling for tlb misses steiner
2010-08-26 13:19 ` [Patch 15/25] GRU - reorder interrupt processing steiner
2010-08-26 13:19 ` [Patch 16/25] GRU - add refcnt to vdata structure steiner
2010-08-26 13:19 ` [Patch 17/25] GRU - no panic on gru malfunction steiner
2010-08-26 13:19 ` [Patch 18/25] GRU - contexts must contain cbrs steiner
2010-08-26 13:19 ` [Patch 19/25] GRU - update debug messages and comments steiner
2010-08-26 13:19 ` [Patch 20/25] GRU - add gsh information to gru dumps steiner
2010-08-26 13:19 ` [Patch 21/25] GRU - delete unused gru statistics structure steiner
2010-08-26 13:19 ` [Patch 22/25] GRU - gru api cleanup steiner
2010-08-26 13:20 ` [Patch 23/25] GRU - update driverr version steiner
2010-08-26 13:20 ` [Patch 24/25] GRU - rename gru pagesize defines steiner
2010-08-26 13:20 ` [Patch 25/25] GRU - update cbrstate definitions steiner
-- strict thread matches above, loose matches on Subject: below --
2010-07-19 21:32 [Patch 00/25] GRU - GRU Updates steiner
2010-07-19 21:32 ` [Patch 02/25] GRU - skip gru tlb purging of gru contexts:w steiner
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=20100826132123.311733838@sgi.com \
--to=steiner@sgi.com \
--cc=akpm@linux-foundation.org \
--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