* [PATCH] powerpc: remove unneeded check in spu_gang_remove_ctx
@ 2015-06-22 18:49 Yury Norov
0 siblings, 0 replies; only message in thread
From: Yury Norov @ 2015-06-22 18:49 UTC (permalink / raw)
To: arnd, benh, paulus
Cc: linuxppc-dev, cbe-oss-dev, linux-kernel, klimov.linux, Yury Norov
In discussion to patch "selinux: reduce locking overhead in
inode_free_security()" it was figured out that list_del_init()
is safe to be called multiple times on the same entry. In that
case, it was useful to move a check out of spinlock to decrease
lock contention. Here we can remove '!list_empty()' check completely
and decrease 'spu_gang_remove_ctx()' function size, and (sometimes)
avoid branch predictor misses.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
arch/powerpc/platforms/cell/spufs/gang.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/gang.c b/arch/powerpc/platforms/cell/spufs/gang.c
index 71a4432..67e3fc3 100644
--- a/arch/powerpc/platforms/cell/spufs/gang.c
+++ b/arch/powerpc/platforms/cell/spufs/gang.c
@@ -75,10 +75,10 @@ void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx)
{
mutex_lock(&gang->mutex);
WARN_ON(ctx->gang != gang);
- if (!list_empty(&ctx->aff_list)) {
- list_del_init(&ctx->aff_list);
- gang->aff_flags &= ~AFF_OFFSETS_SET;
- }
+
+ list_del_init(&ctx->aff_list);
+ gang->aff_flags &= ~AFF_OFFSETS_SET;
+
list_del_init(&ctx->gang_list);
gang->contexts--;
mutex_unlock(&gang->mutex);
--
2.1.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-22 18:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-22 18:49 [PATCH] powerpc: remove unneeded check in spu_gang_remove_ctx Yury Norov
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).