lkml.org 
[lkml]   [2023]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH v5 09/19] locking/mutex: Switch to mutex handoffs for CONFIG_PROXY_EXEC
    From
    From: Peter Zijlstra <peterz@infradead.org>

    Just the very earliest framework logic to provide
    the config option and switch to using mutex
    handoffs.

    Cc: Joel Fernandes <joelaf@google.com>
    Cc: Qais Yousef <qyousef@google.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Juri Lelli <juri.lelli@redhat.com>
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Cc: Valentin Schneider <vschneid@redhat.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Ben Segall <bsegall@google.com>
    Cc: Zimuzo Ezeozue <zezeozue@google.com>
    Cc: Youssef Esmat <youssefesmat@google.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Waiman Long <longman@redhat.com>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: "Paul E . McKenney" <paulmck@kernel.org>
    Cc: kernel-team@android.com
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    [rebased, added comments and changelog]
    Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
    [Fixed rebase conflicts]
    [squashed sched: Ensure blocked_on is always guarded by blocked_lock]
    Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
    [fix rebase conflicts, various fixes & tweaks commented inline]
    [squashed sched: Use rq->curr vs rq->proxy checks]
    Signed-off-by: Connor O'Brien <connoro@google.com>
    [jstultz: Split out only the very basic initial framework
    for proxy logic from a larger patch.]
    Signed-off-by: John Stultz <jstultz@google.com>
    ---
    v5:
    Split out from core proxy patch
    ---
    kernel/Kconfig.locks | 2 +-
    kernel/locking/mutex.c | 5 +++++
    2 files changed, 6 insertions(+), 1 deletion(-)

    diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
    index 4198f0273ecd..791c98f1d329 100644
    --- a/kernel/Kconfig.locks
    +++ b/kernel/Kconfig.locks
    @@ -226,7 +226,7 @@ config ARCH_SUPPORTS_ATOMIC_RMW

    config MUTEX_SPIN_ON_OWNER
    def_bool y
    - depends on SMP && ARCH_SUPPORTS_ATOMIC_RMW
    + depends on SMP && ARCH_SUPPORTS_ATOMIC_RMW && !PROXY_EXEC

    config RWSEM_SPIN_ON_OWNER
    def_bool y
    diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
    index 687009eca2d1..5125bbab4119 100644
    --- a/kernel/locking/mutex.c
    +++ b/kernel/locking/mutex.c
    @@ -913,6 +913,10 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne

    mutex_release(&lock->dep_map, ip);

    +#ifdef CONFIG_PROXY_EXEC
    + /* Always force HANDOFF for Proxy Exec for now. Revisit. */
    + owner = MUTEX_FLAG_HANDOFF;
    +#else /* CONFIG_PROXY_EXEC */
    /*
    * Release the lock before (potentially) taking the spinlock such that
    * other contenders can get on with things ASAP.
    @@ -935,6 +939,7 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
    return;
    }
    }
    +#endif /* CONFIG_PROXY_EXEC */

    raw_spin_lock_irqsave(&lock->wait_lock, flags);
    debug_mutex_unlock(lock);
    --
    2.42.0.rc1.204.g551eb34607-goog
    \
     
     \ /
      Last update: 2023-08-19 08:12    [W:2.735 / U:0.136 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site