Re: [PATCH] Yielding processor resources during lock contention

From: Anton Blanchard (anton_at_samba.org)
Date: 09/12/04

  • Next message: Nick Piggin: "Re: [pagevec] resize pagevec to O(lg(NR_CPUS))"
    Date:	Sun, 12 Sep 2004 15:10:54 +1000
    To: Andrew Morton <akpm@osdl.org>
    
    

     
    > Now, maybe Paul has tied himself into sufficiently tangly locking knots
    > that in some circumstances he needs to spin on the lock and cannot schedule
    > away. But he can still use a semaphore and spin on down_trylock.
    >
    > Confused by all of this.

    On a shared processor machine you might have a 4 way box with a number
    of 4 way partitions on it. Having them sized as 4 way partitions allows
    them to utilise the entire machine when the others are idle.

    Now when all partitions start getting busy you have the problem where
    one partition may be spinning waiting for a lock but the cpu with the
    lock is not currently being scheduled by the hypervisor. Some other
    partition is running over there.

    At the moment we spin burning cycles until the other cpu finally gets
    scheduled by the hypervisor. A slightly better option is for the busy
    spinning cpu to call the hypervisor telling it youve got no useful work
    to do.

    The best option is to call the hypervisor and tell it that you are are
    busy spinning waiting for that other cpu to be scheduled. The hypervisor
    then takes whatever action it sees fit (transferring the current cpus
    timeslice to the other cpu etc).

    Anton
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Nick Piggin: "Re: [pagevec] resize pagevec to O(lg(NR_CPUS))"

    Relevant Pages

    • Re: [PATCH] mutex: have non-spinning mutexes on s390 by default
      ... we could possibly do a monitor wait on the lock owner field ... current cpu and give it back to the hypervisor. ... that this cpu has to run again it will be scheduled again. ... schedule me again until cpu x was has been scheduled". ...
      (Linux-Kernel)
    • Re: [PATCH] stopmachine: add stopmachine_timeout
      ... I think this could become interesting on virtual machines. ... This would cause a failure even if the cpu is not really locked ... becomes unresponsive so that it won't schedule a MAX_RT_PRIO-1 ... We could either hook cpu_relaxinto a hypervisor yield, ...
      (Linux-Kernel)
    • Re: [PATCH] Yielding processor resources during lock contention
      ... The hypervisor can preempt us anywhere but we can give it clues so it ... is the cpu Im waiting for currently scheduled on another ... make an effort to schedule it. ...
      (Linux-Kernel)
    • Re: Lies, Damn Lies and Statistics...
      ... I've never looked at the source code of either IDS or DB2. ... dynamically add shared memory segments on Linux. ... free to schedule any other DB2 thread on that same processor, ... That also means that as one CPU gets too overloaded, ...
      (comp.databases.informix)
    • [git pull] scheduler, futex, lockdep fixes
      ... Called when kernel memory is freed, ... * schedule() atomically, we ignore that path for now. ... * Move task off this cpu, ... * Force a reinitialization of the sched domains hierarchy. ...
      (Linux-Kernel)