From patchwork Wed May 9 19:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10390681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19D4B60236 for ; Wed, 9 May 2018 19:39:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09AD528469 for ; Wed, 9 May 2018 19:39:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F22ED284D4; Wed, 9 May 2018 19:39:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 840A028469 for ; Wed, 9 May 2018 19:39:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 886856B0570; Wed, 9 May 2018 15:38:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 80F666B0574; Wed, 9 May 2018 15:38:48 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DB116B0575; Wed, 9 May 2018 15:38:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id 0DFA56B0570 for ; Wed, 9 May 2018 15:38:48 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id q67-v6so11661241wrb.12 for ; Wed, 09 May 2018 12:38:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1DhEb2JzubBf0Qmab6Qn2Irv2XYafc2dGzTeV12voPY=; b=G4qUTQbU+LyDsGW/CMWwQkfdyoAaqY3Z2NGuIIOCUCTr7KU0NjWfDi88D5XO8D6TPh dGMVOY2ja4Bf0jnyZZBgMTRhq4EsOQoDjz9p/lUnUZbKRd9AFrXSZ0u4pxcdbMOXjRZH YqtqOVie3/ISkyWpvy7zLVpg38FDlT7U5ISrUN8Q62kNhaWWDS79lFgqIG+BGKZt1OtA HwUHTPJD5gxSY69bdj2nUzY7EiVvYIFETDLtpmhz2dZrMFsR6s6/eJyQ+P42D63z/uCf 09nRuSdhDL8/T2PRAvxPzRBPL5DAaS3fRhu81PfOdmvD23Y/SyPadxSatfjOIsldu7/F SO6A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-Gm-Message-State: ALQs6tClPzhdzlO7Ol5wye7/rFZrinvGW7L3Zd14MrFQHJqsfnCRtt5C 0YH5EiikUtKV7VrFyudyMZzyWkesvYTPMOaV1WGXwncfeEaYrKX882jMmQQ8fZdsdTaKHuKOZ9G Z0hLShwJNUfkr83YkbEAfTUkApoxlaZErNSDAJbpacTfcrIFMhXeTxkfiQrTK49a4bA== X-Received: by 2002:adf:a0b8:: with SMTP id m53-v6mr37730740wrm.269.1525894727639; Wed, 09 May 2018 12:38:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo360lrIGhOGG3OJBLl2Yx++1oeLADKtfkF6IM2zMx+uViWi5Y/FcmNK/qqrUgj8POOP6bF X-Received: by 2002:adf:a0b8:: with SMTP id m53-v6mr37730714wrm.269.1525894726859; Wed, 09 May 2018 12:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525894726; cv=none; d=google.com; s=arc-20160816; b=w2IDVRIsODUsRJHhoXgiefl/LL57hW9EBqTxAUs7gb3mphxv/mTSZnKl6gC3JHz3cp r2L1B2sYosEEHLqQpT7NgVFCUFS1UHoywkceJHM/W/zjFI1Sn6xnfkQCuXt4X+FqBRq3 LP2eaIBiPYCazHjJsAjVl3GXpMgSJOI88FS2krQ18KS/H8pOrjFxvsUZ3lanQC4U9gRT qTdU0qqqPl7GooKEF03u2j0ROx4ieltUIe+tPHInPhph4/AaA9a6P+PsJKTMMDiF+Lhn eymMw9UzHO3hqAHBlTv5PkPWIM1Fr5RlzTXGh+9fus9i5EHkgVLYq18J/rmDgwKsRh+7 Y90w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=1DhEb2JzubBf0Qmab6Qn2Irv2XYafc2dGzTeV12voPY=; b=hthcvYS6qM80Gn7bu6iiIbEq7W9yscu+7S/8xeCKhqTLCoXtYunl0ri/0t9gK0suMm kVWEgRYF2BhpAbGNlUFFcue7AKkPkvFnFjIpVFEqRN6JxurG5SIUVa7wINh6p2/h3V9S zFhgRdLhpAgYQ/v+QmQWJ6IVbd5TRhx5rl/tCKqumFBgeymd7ALcKtwYLQFJbDdKYyH3 XaxbNgeF0XgmRKAWIrWEbFoiRTQyC9aZwZ2jUbV4p8fbO/EysFcfUQt4lcmNQnZmv3N0 7WJti5EGIUj3gBYcUxv8xPc/ze7FH3mOqyRzV4/SCzxL7aEtSQ95jNMC9yPXXAre995r dNSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id w49-v6si23672352wrc.32.2018.05.09.12.38.46 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 09 May 2018 12:38:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fGUvC-0005v9-Cz; Wed, 09 May 2018 21:38:42 +0200 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, Peter Zijlstra , Ingo Molnar , linux-mm@kvack.org, Shaohua Li , linux-raid@vger.kernel.org, Anna-Maria Gleixner , Sebastian Andrzej Siewior Subject: [PATCH 6/8] userns: Use irqsave variant of refcount_dec_and_lock() Date: Wed, 9 May 2018 21:36:43 +0200 Message-Id: <20180509193645.830-7-bigeasy@linutronix.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509193645.830-1-bigeasy@linutronix.de> References: <20180509193645.830-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Anna-Maria Gleixner The irqsave variant of refcount_dec_and_lock handles irqsave/restore when taking/releasing the spin lock. With this variant the call of local_irq_save/restore is no longer required. Signed-off-by: Anna-Maria Gleixner [bigeasy: s@atomic_dec_and_lock@refcount_dec_and_lock@g ] Signed-off-by: Sebastian Andrzej Siewior --- kernel/user.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/user.c b/kernel/user.c index 5f65ef195259..0df9b1640b2a 100644 --- a/kernel/user.c +++ b/kernel/user.c @@ -169,11 +169,8 @@ void free_uid(struct user_struct *up) if (!up) return; - local_irq_save(flags); - if (refcount_dec_and_lock(&up->__count, &uidhash_lock)) + if (refcount_dec_and_lock_irqsave(&up->__count, &uidhash_lock, &flags)) free_user(up, flags); - else - local_irq_restore(flags); } struct user_struct *alloc_uid(kuid_t uid)