aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru/grutables.h
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-06-17 19:28:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:04:00 -0400
commit836ce679c0b5b5040164171afc33753396864b30 (patch)
tree786be786c29fa6821d8ee95668393cd43193a278 /drivers/misc/sgi-gru/grutables.h
parent6e9100741ca430eeef8022794f8b62a23a5916af (diff)
gru: change resource assignment for kernel threads
Change the way GRU resources are assigned for kernel threads. GRU contexts for kernel threads are now allocated on demand and can be stolen by user processes when idle. This allows MPI jobs to use ALL of the GRU resources when the kernel is not using them. Signed-off-by: Jack Steiner <steiner@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-gru/grutables.h')
-rw-r--r--drivers/misc/sgi-gru/grutables.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
index 4ddb5b92acbb..1c85fdcf5d37 100644
--- a/drivers/misc/sgi-gru/grutables.h
+++ b/drivers/misc/sgi-gru/grutables.h
@@ -174,9 +174,12 @@ struct gru_stats_s {
174 atomic_long_t assign_context; 174 atomic_long_t assign_context;
175 atomic_long_t assign_context_failed; 175 atomic_long_t assign_context_failed;
176 atomic_long_t free_context; 176 atomic_long_t free_context;
177 atomic_long_t load_context; 177 atomic_long_t load_user_context;
178 atomic_long_t unload_context; 178 atomic_long_t load_kernel_context;
179 atomic_long_t steal_context; 179 atomic_long_t lock_kernel_context;
180 atomic_long_t unlock_kernel_context;
181 atomic_long_t steal_user_context;
182 atomic_long_t steal_kernel_context;
180 atomic_long_t steal_context_failed; 183 atomic_long_t steal_context_failed;
181 atomic_long_t nopfn; 184 atomic_long_t nopfn;
182 atomic_long_t break_cow; 185 atomic_long_t break_cow;
@@ -454,6 +457,9 @@ struct gru_blade_state {
454 reserved cb */ 457 reserved cb */
455 void *kernel_dsr; /* First kernel 458 void *kernel_dsr; /* First kernel
456 reserved DSR */ 459 reserved DSR */
460 struct rw_semaphore bs_kgts_sema; /* lock for kgts */
461 struct gru_thread_state *bs_kgts; /* GTS for kernel use */
462
457 /* ---- the following are protected by the bs_lock spinlock ---- */ 463 /* ---- the following are protected by the bs_lock spinlock ---- */
458 spinlock_t bs_lock; /* lock used for 464 spinlock_t bs_lock; /* lock used for
459 stealing contexts */ 465 stealing contexts */
@@ -597,6 +603,11 @@ static inline void unlock_tgh_handle(struct gru_tlb_global_handle *tgh)
597 __unlock_handle(tgh); 603 __unlock_handle(tgh);
598} 604}
599 605
606static inline int is_kernel_context(struct gru_thread_state *gts)
607{
608 return !gts->ts_mm;
609}
610
600/*----------------------------------------------------------------------------- 611/*-----------------------------------------------------------------------------
601 * Function prototypes & externs 612 * Function prototypes & externs
602 */ 613 */