From: Davidlohr Bueso <dave@stgolabs.net>
To: mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de
Cc: Waiman.Long@hpe.com, jason.low2@hp.com, dave@stgolabs.net,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] locking/rwsem: Drop superfluous waiter refcount
Date: Sun, 8 May 2016 21:56:08 -0700 [thread overview]
Message-ID: <1462769770-29363-3-git-send-email-dave@stgolabs.net> (raw)
In-Reply-To: <1462769770-29363-1-git-send-email-dave@stgolabs.net>
Read waiters are currently reference counted from the time it enters
the slowpath until the lock is released and the waiter is awoken. This
is fragile and superfluous considering everything occurs within down_read()
without returning to the caller, and the very nature of the primitive does
not suggest that the task can disappear from underneath us. In addition,
spurious wakeups can make the whole refcount useless as get_task_struct()
is only called when setting up the waiter.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
kernel/locking/rwsem-xadd.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
index 7d62772600cf..b592bb48d880 100644
--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -197,7 +197,6 @@ __rwsem_do_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type)
smp_mb();
waiter->task = NULL;
wake_up_process(tsk);
- put_task_struct(tsk);
} while (--loop);
sem->wait_list.next = next;
@@ -220,7 +219,6 @@ struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
/* set up my own style of waitqueue */
waiter.task = tsk;
waiter.type = RWSEM_WAITING_FOR_READ;
- get_task_struct(tsk);
raw_spin_lock_irq(&sem->wait_lock);
if (list_empty(&sem->wait_list))
--
2.8.1
next prev parent reply other threads:[~2016-05-09 5:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 4:56 [PATCH -tip 0/4] locking/rwsem (xadd): Reader waiter optimizations Davidlohr Bueso
2016-05-09 4:56 ` [PATCH 1/4] locking/rwsem: Avoid stale ->count for rwsem_down_write_failed() Davidlohr Bueso
2016-05-09 5:36 ` Peter Hurley
2016-05-09 7:12 ` Peter Zijlstra
2016-05-09 14:29 ` Davidlohr Bueso
2016-05-09 4:56 ` Davidlohr Bueso [this message]
2016-05-09 7:39 ` [PATCH 2/4] locking/rwsem: Drop superfluous waiter refcount Peter Zijlstra
2016-05-09 15:56 ` Davidlohr Bueso
2016-05-09 16:11 ` Peter Zijlstra
2016-05-09 18:51 ` Davidlohr Bueso
2016-05-09 18:59 ` Peter Zijlstra
2016-05-09 4:56 ` [PATCH 3/4] locking/rwsem: Enable lockless waiter wakeup(s) Davidlohr Bueso
2016-05-09 7:48 ` Peter Zijlstra
2016-05-09 4:56 ` [PATCH 4/4] locking/rwsem: Rework zeroing reader waiter->task Davidlohr Bueso
2016-05-09 7:50 ` Peter Zijlstra
2016-05-10 1:31 ` [PATCH -tip 0/4] locking/rwsem (xadd): Reader waiter optimizations Waiman Long
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462769770-29363-3-git-send-email-dave@stgolabs.net \
--to=dave@stgolabs.net \
--cc=Waiman.Long@hpe.com \
--cc=jason.low2@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®