From patchwork Fri Jan 11 00:26:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10757089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE22913B5 for ; Fri, 11 Jan 2019 00:26:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA69A29A88 for ; Fri, 11 Jan 2019 00:26:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE67329AAF; Fri, 11 Jan 2019 00:26:46 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 4C37D29A98 for ; Fri, 11 Jan 2019 00:26:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DBFA8E0004; Thu, 10 Jan 2019 19:26:44 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4B6D48E0001; Thu, 10 Jan 2019 19:26:44 -0500 (EST) 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 37D198E0004; Thu, 10 Jan 2019 19:26:44 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id EB0F98E0001 for ; Thu, 10 Jan 2019 19:26:43 -0500 (EST) Received: by mail-pl1-f198.google.com with SMTP id ay11so7203175plb.20 for ; Thu, 10 Jan 2019 16:26:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version; bh=rybgnvg4UUXVXfPODAcLL7t8ooaSruZ0ikD0phBPoYw=; b=ICEkxXGN80ixnatr8OBwbgE9zz62FJSy1Qu7TCzq5AmZeEleRTLEr3jhUGYrrbEh+V YKCxnk2U/G2zzx1ENmLLHXYowJRXCSDMHXWZk6YIAe8SzY5T4yc1EF5pm6Au68cgfl5r WNrsKSzONJdrL84DaXxz3z9gc9HNAb1Wv51VzPSBNqoxRhiQC5D3pUvaPO5uRE4mAfWK 7AxP4A/R21Z6Lr4jSEZY6s5CBHZQZXhA9oeHz1C3BroyE4fMKsvFnhgxO0CegT5DcoVu VDnSx8lfqJuGw3X0FuHiHSomeBD3lRN+YL+5jGYHUw38DGZTLl3ahlw5fu4o3PZe5QHd 3rxA== X-Gm-Message-State: AJcUukdrD4UySbC6aWZDKyPJjEa7NkTXIKjBruXu0VZBrPTm232YBP7m FLU+p0UfeLWfXNMTPWPGpRhwvt2iPpunGiaS4+CVdQsooZYwTA4Vyigq+KFilZEjpDm51iBU4LJ /diSL6V+jqerdz2IkxpUs2JDust06BuufggYeRH7ljvP2n7C4fMh90aHFTP3TxzqfpQ== X-Received: by 2002:a17:902:b494:: with SMTP id y20mr12704315plr.178.1547166403645; Thu, 10 Jan 2019 16:26:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN4GwJ132tncLwpZJvGyY1pl9zDH+RyUACFXUQFHlRIRosE+B6i+yWsOfhkyFH02FQ1SqTEg X-Received: by 2002:a17:902:b494:: with SMTP id y20mr12704284plr.178.1547166402837; Thu, 10 Jan 2019 16:26:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547166402; cv=none; d=google.com; s=arc-20160816; b=MWBCAESJ1XAgOrWts6TGp6dYdHUla57rcWZiyhD2T4XrfpQsOw8qQlpb12G5rIALqr 0urjTkeYJelLv2sDIyZ5Jy0fgXXQgHCHfsEjK4upqzZmpaV3Pqll7rv0TrGoi8tuKm6Y /YTu+lRh8Dnxh+vOxTjCmedtncLg9fRWhpXg0WZzgyA8Km0unyo9ZK9X6V5/QBwrs41v tz2GNxSrsFID7elfn8bDRdlJbGiYIV0sdKPRiJim0nd6BiBJ80KyyzOMgny0R89IXJ1E DdLxRPutIkIpC12NMcnwEsY/I6MtBd7cQ8qVyR58gp11HUjs+iiFimNtl1EoEcp705/E yzIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rybgnvg4UUXVXfPODAcLL7t8ooaSruZ0ikD0phBPoYw=; b=VaUuy/Enq3yL8GQHrKUktM741WRJmfCT6T5HBSwXcRbq9Nb15m013uUrRm37fv22dQ ouadvjy7wD8LFtid+4d1D/8t8AwJ82i34/o7z9JBjnBlW7ZkgBAmTOJJIY90IYoO4Q0s 4N2Vmimno7usDmm2QVwqvQ0Svb2J4Vgg7O/mA0t2dv2rinZgzxQuxUrBX0JUqB7AqBmB meD2eX9RWa2n0gavsy1qM7rF9M3lMRFwVGtRSfyLtPooul8F+PTQE6IrWajYMfljIFLA 8z5XA47LNIiTnAvNVLZ/5FW4rfxg3YX6WqbEitny12HpMarmDPjBSPJIKfd9bA7OVxyG PbEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=XGRLCVo2; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.47.9 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from smtprelay.synopsys.com (smtprelay.synopsys.com. [198.182.47.9]) by mx.google.com with ESMTPS id c3si7995688plr.178.2019.01.10.16.26.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 16:26:42 -0800 (PST) Received-SPF: pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.47.9 as permitted sender) client-ip=198.182.47.9; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=XGRLCVo2; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.47.9 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 1C92F24E0607; Thu, 10 Jan 2019 16:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1547166402; bh=DVgWT4VOpi5ItAo8wxhZ9DfXiDw+m8gVPchbHy0ojuI=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=XGRLCVo2XP8tQkWnaZQIZmEQVgpVkqn/Duw+Pi8ivbRQpZ0r0oZFFS8mKFKtld5U/ j42v9RNlWg2TsIkvLteU7Hncr1BOYWa1KQdvttpfsOtWI2uVg1o4pe2BF1w19sp+OT aT4MQ7BHFq6F1sY8SOz2ZMlw/cIBsURPohz92YgHzUcEnbdGGt5VLNnz96Britwkr/ s9ap5nwiAZY1pyftzTdIJ1kyXBpm9BcUaKt09EDMrilUQgL0GHep4l/rrnPRWm73mg 7vBKSTwfVbnZ/vaqOvZcx5f6V8JaNr3JrUvM5yfuq/7EVXaYJe2fTdSHV9GnNgGyIz 8FRViI6ZPLrJg== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 931343436; Thu, 10 Jan 2019 16:26:41 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 10 Jan 2019 16:26:41 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 05:56:42 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 05:56:43 +0530 From: Vineet Gupta To: CC: , , , Vineet Gupta , Alexander Viro , Subject: [PATCH 1/3] coredump: Replace opencoded set_mask_bits() Date: Thu, 10 Jan 2019 16:26:25 -0800 Message-ID: <1547166387-19785-2-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547166387-19785-1-git-send-email-vgupta@synopsys.com> References: <1547166387-19785-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 Cc: Alexander Viro Cc: Peter Zijlstra (Intel) Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/g/20150807115710.GA16897@redhat.com Acked-by: Oleg Nesterov Signed-off-by: Vineet Gupta Reviewed-by: Anthony Yznaga --- fs/exec.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index fb72d36f7823..df7f05362283 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1944,15 +1944,10 @@ EXPORT_SYMBOL(set_binfmt); */ void set_dumpable(struct mm_struct *mm, int value) { - unsigned long old, new; - if (WARN_ON((unsigned)value > SUID_DUMP_ROOT)) return; - do { - old = READ_ONCE(mm->flags); - new = (old & ~MMF_DUMPABLE_MASK) | value; - } while (cmpxchg(&mm->flags, old, new) != old); + set_mask_bits(&mm->flags, MMF_DUMPABLE_MASK, value); } SYSCALL_DEFINE3(execve, From patchwork Fri Jan 11 00:26:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10757091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C494513B5 for ; Fri, 11 Jan 2019 00:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B149729A88 for ; Fri, 11 Jan 2019 00:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4D0E29AAF; Fri, 11 Jan 2019 00:26:50 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 41DC529A88 for ; Fri, 11 Jan 2019 00:26:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E52EF8E0005; Thu, 10 Jan 2019 19:26:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E29168E0001; Thu, 10 Jan 2019 19:26:48 -0500 (EST) 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 D40908E0005; Thu, 10 Jan 2019 19:26:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by kanga.kvack.org (Postfix) with ESMTP id 9635C8E0001 for ; Thu, 10 Jan 2019 19:26:48 -0500 (EST) Received: by mail-pl1-f197.google.com with SMTP id h10so7184646plk.12 for ; Thu, 10 Jan 2019 16:26:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version; bh=aYYSVpAP/XnYwzxtImxbDnmSdr8MYb+OpJ8V5+H7hRI=; b=TNoNwkQum9QmbHjzxNb/m2CewPd3pkX17KQh/WDrS8BT+KUZprJmxcnjoyCXY/O55R E7Qwsa4KopQF5tNqvddc8ALWeQ18efXj8Wu9DGLAdm+QtVW65w3xnDEq0C3fMD2boj3U U3asetsA5MJ10FAQeyM8rJTtVGp6MAFzFiEU07lTZYThgEBYaVOuluGUSms3yiuXs8sx +ZsWMSuh5WoOc6O7cQosjfsj9q5PU3msFM3IZrp/cRhacJV58siZK/s5WfMVdHhGr5XW Fk2W0tUwVWXiLjPBv7cF94oAAmeDvz9zGfI0kHMPjQ7z+FyuSPTNG0RzyBqGtcHjAFZW Z2Gg== X-Gm-Message-State: AJcUukc+4XPbXsfZpS31xEatnqOtZSxSVkWydgExF7+hgmZadO+zZu4f lT5NrYjWl7XO1RB201V8VNaVxC/NvQdU7kQ9M0p6FVh5UsDn295B/NRALbL/iPTkk2i7NS2pmKs OKya/wX+fzePl8ct503tV5fcwIiO/mY7v26IqXSm2fRo8hiHfwQYvaJhmG+7iGyoL5g== X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr12708036plt.106.1547166408295; Thu, 10 Jan 2019 16:26:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ZiPdVdqNRwb+KnEGh1QAIcmm4T8uErKhFlzXHFYv2xHKYtKF+cEG77hbiE9TWpBX25+io X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr12708011plt.106.1547166407567; Thu, 10 Jan 2019 16:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547166407; cv=none; d=google.com; s=arc-20160816; b=czP+rcXd3Gl1SY2hTz/nLN15eZDCtgchS/xgLqDjisheVB2UYAnE9DEHxTn5QBlDFg cEFJ0f/A2lpPaQ2CSmUCthvug8WWKoM5v5t8fPQnP4v3JKpmPgreeVWDEUqTyixfSRHO Jc7N9YOfuBwHs+WDxxblRaJG45XqCK5Mi6nS5OeL51X4TAR71TwSU09+rFkbqWTUkTjK YhwVyvF8p5f7ywsbjTv/Q3CIprkmZp46YPHX/bKWmJzd0ErpauUrL9KpAaA+7lRGQwfq aPnK5h0gi1jEqWVyDqFNZFl4mW+uabpgp5c10g45vO+4w3KMk3ygbbdUk9jRJ0K3JmfT C/ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aYYSVpAP/XnYwzxtImxbDnmSdr8MYb+OpJ8V5+H7hRI=; b=bZQ6sHsnbX2gmbGppQcKJWCsHbWb9TKKrUiESucElJ6VtfU2m+CbgC/pT09t8JRygv kr2TdXk2+WKC6P+38kNLWUk5jzr5cRepNMNSLb3mIltMN5qzD1I9hQ2yZdilpDi/1T6P pSsZDJIO6FJhSwC5+dsDjcGOT3xW8+l2SE+V0BloEwNuPw2pcmhpnZKUHKCFF6S1KhZe U4pUbl490/ZKew0XWYOnVKtS3DuDj9VMj/kdSD04h8aJWwjyEkTSZyH0VhqkRWNwSsWQ WPcpm1yIRAnDYyNcDPITSJGslvr/vRRTvTlI1rOv4LCP7C2Ix8iM3Pkqz43pxOF3V2zX afjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=SqmSf2Nr; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com. [198.182.60.111]) by mx.google.com with ESMTPS id v9si10761030pgo.23.2019.01.10.16.26.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 16:26:47 -0800 (PST) Received-SPF: pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) client-ip=198.182.60.111; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=SqmSf2Nr; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id E8EB710C0D59; Thu, 10 Jan 2019 16:26:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1547166407; bh=eKBup9uhbGbyAPqlLa4zZa3Jtqj2PAt9eLGZkA1RvN4=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=SqmSf2NrQugccT38I5aHfN4WFd6vJlQdry2qm8IJGUX2JbU0uKPyw1epBo6W8oxK2 utBjd2Pz0AtwCcCTULpwDz1bmiYsRJJvVNjtgphq/lkDy1crFKgXDb8aFavfTFBcq3 9Mr5smW2c5dHkYkYJfu7Xb6WOCJFCdPCqBfa1M98RQUA79zl+UxfTURhlRZIH4y6Wq 8mN5jOgB5BhMWbZgbz0uwSOG/AueWakpTA2WPe4RvFM6ZTMlAvbnqPCz+VNOEPHpap pQwVZedlhtdi1U0DfuqTUVaMBcwRDiTy67Vl9EosS43I/HKR1jKhuSd+yFiLU/5toX f7kMbiWCbTZbA== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id BCA10344D; Thu, 10 Jan 2019 16:26:46 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 10 Jan 2019 16:26:46 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 05:56:45 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 05:56:46 +0530 From: Vineet Gupta To: CC: , , , Vineet Gupta , Alexander Viro , Theodore Ts'o , Subject: [PATCH 2/3] fs: inode_set_flags() replace opencoded set_mask_bits() Date: Thu, 10 Jan 2019 16:26:26 -0800 Message-ID: <1547166387-19785-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547166387-19785-1-git-send-email-vgupta@synopsys.com> References: <1547166387-19785-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 It seems that 5f16f3225b0624 and 00a1a053ebe5, both with same commitlog ("ext4: atomically set inode->i_flags in ext4_set_inode_flags()") introduced the set_mask_bits API, but somehow missed not using it in ext4 in the end Also, set_mask_bits is used in fs quite a bit and we can possibly come up with a generic llsc based implementation (w/o the cmpxchg loop) Cc: Alexander Viro Cc: Theodore Ts'o Cc: Peter Zijlstra (Intel) Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Vineet Gupta Reviewed-by: Anthony Yznaga --- fs/inode.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 0cd47fe0dbe5..799b0c4beda8 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2096,14 +2096,8 @@ EXPORT_SYMBOL(inode_dio_wait); void inode_set_flags(struct inode *inode, unsigned int flags, unsigned int mask) { - unsigned int old_flags, new_flags; - WARN_ON_ONCE(flags & ~mask); - do { - old_flags = READ_ONCE(inode->i_flags); - new_flags = (old_flags & ~mask) | flags; - } while (unlikely(cmpxchg(&inode->i_flags, old_flags, - new_flags) != old_flags)); + set_mask_bits(&inode->i_flags, mask, flags); } EXPORT_SYMBOL(inode_set_flags); From patchwork Fri Jan 11 00:26:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10757093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3E221390 for ; Fri, 11 Jan 2019 00:26:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E091329A88 for ; Fri, 11 Jan 2019 00:26:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4E1529AAF; Fri, 11 Jan 2019 00:26:54 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 5B9B429A88 for ; Fri, 11 Jan 2019 00:26:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21EAD8E0006; Thu, 10 Jan 2019 19:26:53 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1CC6B8E0001; Thu, 10 Jan 2019 19:26:53 -0500 (EST) 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 0E5878E0006; Thu, 10 Jan 2019 19:26:53 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id C3F628E0001 for ; Thu, 10 Jan 2019 19:26:52 -0500 (EST) Received: by mail-pg1-f200.google.com with SMTP id t26so7341521pgu.18 for ; Thu, 10 Jan 2019 16:26:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version; bh=tONnOyuB2lpOpSvJpJpHHz+Hr9EbTu2vK/iB0IQUkdQ=; b=W4NabjbInN9KshHpk+nap8RYIi4ooMSzvbx2SKlx93HXrvGw5ZCqHQZa09LmQuuz34 7QV7QTNk8yy3KyVLF8KkjKZ47B7mPQvHmJ+dGbScZU3bjyIU4qHnReCGzMCIijhdcXJs FwLj+xuA2qVjLXZkUgblEp0wPwXsTtSWfl2MRi1P19iuYX2YoO40An+hdC0+dIVmn5FP SPKoSs+FjAkYJRq+9OzQJGte3SKrYQ7PlEGsuuytVtryxBViXy7qTacjX6Ws5gaON62b XMaQAgbUQ0vDw8X4wLWGN6Mc/aJecdCmBJnFQ+aHnQ/TQcSduyV5PdVgIhGD6Rj0jbJv I8XA== X-Gm-Message-State: AJcUukdC8AjuRL+13GPh7/Mx4Y7e3ip9TihET97YTUMpzAZt0qlItrDM PUE27CfmBsIpgea/pTFyeIp/saNpgqU+RE1zokoSwNnZpUFF14dKWtaclOrzHy1UaPNPk1IPwIn efWLDqSqSmCxF3lOZpxd89Ne+BVL722ZP1sUvOCWM+xrIZU7GpWooW11zjL3eGo8uHA== X-Received: by 2002:a62:399b:: with SMTP id u27mr12781368pfj.181.1547166412458; Thu, 10 Jan 2019 16:26:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4C+Y4CSE9ZT1qaANaxzh8RCnDltFE5I9VwzCsdKs31J+BasHDsAr825S4PzL3dhJ7iRMds X-Received: by 2002:a62:399b:: with SMTP id u27mr12781339pfj.181.1547166411811; Thu, 10 Jan 2019 16:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547166411; cv=none; d=google.com; s=arc-20160816; b=fFOlfx05TziAVfsXBjvX7ZOzUDx3rSRc7coECcogWEQEg0ow8offhBPndyWpOOnKBL G2wqokqlKXg0xKEiytu/uz137lmYD7LcleUu9K50jpO79WRoz7J6yjPCylOmTLQVIpkx vZfmk0f+j20fJzYiIYzVxxaWgUYP/6PYbZppEn9YuIt+wmpq5Z6mBshVRNGUa5O5lr+/ Atpek8BkxCC/RsOhgu0EpPjGZwvF3xY1vROtgLKTDjtOStoHH3Zr444ie233peYoMTph QknfHwIkFQ7cvUQ7GOUVifzsa8T49yV7xNAvocXc6cnBsO5CCihiNGvigiss8fo3y7qK yoyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tONnOyuB2lpOpSvJpJpHHz+Hr9EbTu2vK/iB0IQUkdQ=; b=pBD1MD6t2xTI1FHlalnieJqY4WSWZ8wid9WjUubrl7L+VMhyI3yWMvI3xSd3mFUT7T nMle0JK6Ur8eG7u9EgPf4zFnEsVR5r2tLvQ8iEa9jeqTFprK6thQV4V8nUhzA2IwL0Le dVJ1UsrffjqBEYA4YVvWtnImHDocJoGyG9e3KFZr5ehJWk4f10qNbgTqTHYu56iD11TM bK8rybWaOjIsRVoUbpbSWaIOrrvY2St1QmfZ5uxl/F5IqgIUCZe72F6nTkQh1ZR+F8bv bJ+XAexJ3aaab9ZldvYf8ReXcdEBh4hB/sT2tfetgXEUd08e0xcA08Bzxv6wBJY3cFgT xPUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=arThAiTa; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com. [198.182.60.111]) by mx.google.com with ESMTPS id y6si51191750pll.384.2019.01.10.16.26.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 16:26:51 -0800 (PST) Received-SPF: pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) client-ip=198.182.60.111; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=arThAiTa; spf=pass (google.com: domain of vineet.gupta1@synopsys.com designates 198.182.60.111 as permitted sender) smtp.mailfrom=vineet.gupta1@synopsys.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 99A9E10C06EF; Thu, 10 Jan 2019 16:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1547166411; bh=MTd8hhL8+Yrd4J5zf9O3w4pCpQ1E6m+yK5NdRUgT2As=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=arThAiTak6xtjdEQqT6DCcRORRxKOtPKlTZOKV/ZQLPMuplgeRxm5smd9cNlASzX6 WDjzrQiDGNcYPSXlgN9OrHbfPrCEr9W0qGCRLpKziLfoOP/Vd/z9oRiYFMxP2PCVRN gugo+ZaJnTuhaJcpjCD9DmLCjdPzWf7/WO+qK75/V17XO5DTYREMHipU/BfRqD0UO+ +a140xT9WNax6dENNdLpzceFqSXE1jnIjX1c3yf3RUgFSUjgYpy2KFJazxEWclrz5e EBwuQesuig/h/PxG9jewFe1dQpWDSobr/TZkQPUVlZ4G2nDUBiQQmtb5BawiqzBhFu /nmVMgepWt7Hg== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 63E3B39F7; Thu, 10 Jan 2019 16:26:50 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 10 Jan 2019 16:26:50 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 05:56:48 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 11 Jan 2019 05:56:50 +0530 From: Vineet Gupta To: CC: , , , Vineet Gupta , Miklos Szeredi , Ingo Molnar , Jani Nikula , Chris Wilson , "Andrew Morton" , Will Deacon Subject: [PATCH 3/3] bitops.h: set_mask_bits() to return old value Date: Thu, 10 Jan 2019 16:26:27 -0800 Message-ID: <1547166387-19785-4-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547166387-19785-1-git-send-email-vgupta@synopsys.com> References: <1547166387-19785-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 | > Also, set_mask_bits is used in fs quite a bit and we can possibly come up | > with a generic llsc based implementation (w/o the cmpxchg loop) | | May I also suggest changing the return value of set_mask_bits() to old. | | You can compute the new value given old, but you cannot compute the old | value given new, therefore old is the better return value. Also, no | current user seems to use the return value, so changing it is without | risk. Link: http://lkml.kernel.org/g/20150807110955.GH16853@twins.programming.kicks-ass.net Suggested-by: Peter Zijlstra Cc: Miklos Szeredi Cc: Ingo Molnar Cc: Jani Nikula Cc: Chris Wilson Cc: Andrew Morton Cc: Will Deacon Signed-off-by: Vineet Gupta Reviewed-by: Anthony Yznaga Acked-by: Will Deacon --- include/linux/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 705f7c442691..602af23b98c7 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -246,7 +246,7 @@ static __always_inline void __assign_bit(long nr, volatile unsigned long *addr, new__ = (old__ & ~mask__) | bits__; \ } while (cmpxchg(ptr, old__, new__) != old__); \ \ - new__; \ + old__; \ }) #endif