linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What if a TLB flush needed to sleep?
@ 2008-03-25 20:49 Luck, Tony
  2008-03-25 21:47 ` Alan Cox
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Luck, Tony @ 2008-03-25 20:49 UTC (permalink / raw)
  To: linux-arch; +Cc: linux-mm, linux-kernel

ia64 processors have a "ptc.g" instruction that will purge
a TLB entry across all processors in a system.  On current
cpus there is a limitation that only one ptc.g instruction may
be in flight at a time, so we serialize execution with code
like this:

	spin_lock(&ptcg_lock);
	... execute ptc.g
	spin_unlock(&ptcg_lock);

The architecture allows for more than one purge at a time.
So (without making any declarations about features of
unreleased processors) it seemed like time to update the
code to grab the maximum count from PAL, use that to
initialize a semaphore, and change the code to:

	down(&ptcg_sem);
	... execute ptc.g
	up(&ptcg_sem);

This code lasted about a week before someone ran hackbench
with parameters chosen to cause some swap activity (memory
footprint ~8.5GB on an 8GB system).  The machine promptly
deadlocked because VM code called the tlbflush code while
holding an anon_vma_lock, the semaphore happened to sleep
because some other processor was also trying to do a purge,
and the test was on a system where the limit was still just
one ptc.g at a time, and the process got swapped.

Now for the questions:

1) Is holding a spin lock a problem for any other arch when
doing a TLB flush (I'm particularly thinking of those that
need to use IPI shootdown for the purge)?

2) Is it feasible to rearrange the MM code so that we don't
hold any locks while doing a TLB flush?  Or should I implement
some sort of spin_only_semaphore?

-Tony

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2008-03-29  1:33 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25 20:49 What if a TLB flush needed to sleep? Luck, Tony
2008-03-25 21:47 ` Alan Cox
2008-03-26 12:32 ` Matthew Wilcox
2008-03-26 20:29   ` Luck, Tony
2008-03-27  8:09     ` Jens Axboe
2008-03-27 14:15     ` down_spin() implementation Matthew Wilcox
2008-03-28  0:01       ` Nick Piggin
2008-03-28 12:45         ` Matthew Wilcox
2008-03-28 21:16           ` Luck, Tony
2008-03-28 23:48             ` Arnd Bergmann
2008-03-29  1:04           ` Nick Piggin
2008-03-28  4:51       ` Stephen Rothwell
2008-03-28  5:03         ` Nick Piggin
2008-03-28 12:46           ` Matthew Wilcox
2008-03-28 12:51       ` Jens Axboe
2008-03-28 13:17         ` Matthew Wilcox
2008-03-28 13:24           ` Jens Axboe
2008-03-26 19:25 ` What if a TLB flush needed to sleep? Christoph Lameter
2008-03-26 20:29   ` Thomas Gleixner
2008-03-27  1:19     ` Christoph Lameter
2008-03-27 13:20       ` Peter Zijlstra
2008-03-27 18:44         ` Christoph Lameter
2008-03-28  9:59           ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).