[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <31db67e0-bd9f-ff6d-2cee-b60ad52f71b2@redhat.com>
Date: Tue, 27 Oct 2020 19:50:14 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ben Gardon <bgardon@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Sean Christopherson <sean.j.christopherson@...el.com>,
Peter Shier <pshier@...gle.com>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [PATCH 3/3] sched: Add cond_resched_rwlock
On 27/10/20 19:44, Peter Zijlstra wrote:
> On Tue, Oct 27, 2020 at 09:49:50AM -0700, Ben Gardon wrote:
>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index d2003a7d5ab55..ac58e7829a063 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -6152,6 +6152,46 @@ int __cond_resched_lock(spinlock_t *lock)
>> }
>> EXPORT_SYMBOL(__cond_resched_lock);
>>
>> +int __cond_resched_rwlock_read(rwlock_t *lock)
>> +{
>> + int resched = should_resched(PREEMPT_LOCK_OFFSET);
>> + int ret = 0;
>> +
>> + lockdep_assert_held(lock);
>
> lockdep_assert_held_read(lock);
>
>> +
>> + if (rwlock_needbreak(lock) || resched) {
>> + read_unlock(lock);
>> + if (resched)
>> + preempt_schedule_common();
>> + else
>> + cpu_relax();
>> + ret = 1;
>> + read_lock(lock);
>> + }
>> + return ret;
>> +}
>> +EXPORT_SYMBOL(__cond_resched_rwlock_read);
>> +
>> +int __cond_resched_rwlock_write(rwlock_t *lock)
>> +{
>> + int resched = should_resched(PREEMPT_LOCK_OFFSET);
>> + int ret = 0;
>> +
>> + lockdep_assert_held(lock);
>
> lockdep_assert_held_write(lock);
>
>> +
>> + if (rwlock_needbreak(lock) || resched) {
>> + write_unlock(lock);
>> + if (resched)
>> + preempt_schedule_common();
>> + else
>> + cpu_relax();
>> + ret = 1;
>> + write_lock(lock);
>> + }
>> + return ret;
>> +}
>> +EXPORT_SYMBOL(__cond_resched_rwlock_write);
>
> If this is the only feedback (the patches look fine to me), don't bother
> resending, I'll edit them when applying.
>
If that is an Acked-by, I'll merge them through the KVM tree when time
comes.
Paolo
Powered by blists - more mailing lists