From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752079AbbFVSth (ORCPT ); Mon, 22 Jun 2015 14:49:37 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:32798 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbbFVSt3 (ORCPT ); Mon, 22 Jun 2015 14:49:29 -0400 From: Yury Norov To: arnd@arndb.de, benh@kernel.crashing.org, paulus@samba.org Cc: linuxppc-dev@lists.ozlabs.org, cbe-oss-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, klimov.linux@gmail.com, Yury Norov Subject: [PATCH] powerpc: remove unneeded check in spu_gang_remove_ctx Date: Mon, 22 Jun 2015 21:49:11 +0300 Message-Id: <1434998951-26285-1-git-send-email-yury.norov@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/