From patchwork Wed Jan 23 20:33:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10777821 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 B8D791390 for ; Wed, 23 Jan 2019 20:36:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A87FE2CAF5 for ; Wed, 23 Jan 2019 20:36:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C5762CF59; Wed, 23 Jan 2019 20:36:49 +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 321792CAF5 for ; Wed, 23 Jan 2019 20:36:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6171B8E004B; Wed, 23 Jan 2019 15:36:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5ECB58E0047; Wed, 23 Jan 2019 15:36: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 4DC858E004B; Wed, 23 Jan 2019 15:36:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 0B7F48E0047 for ; Wed, 23 Jan 2019 15:36:48 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id a2so2324475pgt.11 for ; Wed, 23 Jan 2019 12:36: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=Rl8db0nnJLRjwk+udm8zI1dppHxFLCqjaj+7JgpLVt8=; b=fz4EcmB2dLDESMjPJbpjE6CGB31XCUdib2jPCI0YgGWGJ6mN3KcaYPa1y/GHNq4nI7 kG1+9Kl3DCyvEY/FG72xRzF8hPidgMxIIlbBTkI7bmu057NjyRJSh8mOO9vBkvjNZPHT 9r4x4wn2y0JASR3jinLpXAPaMXix+9kJiqgqXhyBY/iS9pUbynGHCOw7Ot2cf2AthYFt wEFAUaIpd+JP12Q7zf8gJHnTHtVGc4XApOT5+4TiSzYbhEy3rPVyN+3i8CzCs57H5Q4Y aqS6wBLAreiOXCvAI5GKQ4oKojOAvXiUdNhb7fkQEWHMuCw3jnzRaM02sb2ye7gvhLSq rvSA== X-Gm-Message-State: AJcUukcds5PVJhQ0r8OfrDAOqDBebnhj5jbMlT9XaOltpHZ6d/5rpqaT 8YAAJX84pGwBq56HVjYUX/pU71xSB80fLt0CbrXrFRoFS/7qCLlxvr++sGJmnBrIsuXR8SJpXQR nwO3d2bLqYbiSy2NDpmRZmCAqcGgu1E7VSjALiNhHtQC3MLYgHGt6Bu57EX5YlPZlJw== X-Received: by 2002:a62:104a:: with SMTP id y71mr3499745pfi.34.1548275807717; Wed, 23 Jan 2019 12:36:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN4R0j5WeL31TYZr3j8l07b0ldS6ilR6TKM/EPYmz1vJyh5ny75/eAlaM96bfB9MxYBAnjgZ X-Received: by 2002:a62:104a:: with SMTP id y71mr3499702pfi.34.1548275807007; Wed, 23 Jan 2019 12:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548275806; cv=none; d=google.com; s=arc-20160816; b=qNGzR6JFJRK6UW9VDdOand/S/OkQ7dgMFelOFsRpo5098+5Rv3f3zdv86nHrakrNal sA0p8snjSNq3epz5vny/1Q/sapupZZjasz3KrQyCplYAH2WXGAyJr13d7c9BryXLesJ1 eguXksK70VEDP3q4MtRxgsET/AfbCAquh6p7pj/L1H9RwOeqiD/PMxxXm4WDUTHRwr47 1FAzAIQC8qXISu4HbFAMKxgteoAffZMSs3sUPzPpzZlpneBc7hWOBdYpnIAyxtbCh6Ne A0rRl9azB+BQKjmRvyB/UWecFIuAr2oc7zK1lj8EJn1XU8WUGll+cve+/NtxIJSl2wV/ nENw== 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=Rl8db0nnJLRjwk+udm8zI1dppHxFLCqjaj+7JgpLVt8=; b=bP+qDdugnkaC6lCs/20WalKaKqVxJjwH7WFj9HidZNhgCMRz6OAjwMUqedMS5lCSjI cB85kMwLk16S749cIFGDJZcp6efm+kl6qZvoPy31TGxnm7OxunkY+0ksWolYm4m+6dju A2NOa+JtfC7CFgxlXhWoIFttKlVNJu+xE7/ArIYZlE9RHXm+cLY/MLtUnD9STozYUQDN 5EFRToJTTjYEJyPzlKqDxHQY6gEMxVv9OopE/raD100e7DDltlv3iM0tr+EUa2YZjv2i sjQzt1yCSRvzEfOxUkyY7XMygHSss1O49twblUVjoQEnAIUG7+N590YqfPEvY4wpxW++ jc+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=dZuKBLN4; 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 n3si20736696pld.36.2019.01.23.12.36.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 12:36:46 -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=dZuKBLN4; 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 (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 4E1E324E09A5; Wed, 23 Jan 2019 12:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1548275806; bh=kJQpOk9ZK86cD+f4lSJLjtMX3cfMvrQBXd+6efrgIP4=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=dZuKBLN4fosMTZqfsal0ZyRo/wn5iUM2k2qZFxow0NmEKflFzF5TFyfm2LdqocROm bDMSfhbtHpZFSJCWhxE2dRYwiF6rKyN9FMzlCcQ1LGeMHIHi5NBINqc8G3EOvnxKRi 6JS+sR1bo9lYJySXOLo02kzhlEifaj/depZm9QfYIF71DF1DYwws5fFV0V9n5wRxki vLPwh5q0FlcQiLAe1ZWQkokaNmnYAapoesdycqhKWu877Z6m9TejcXYHB/kY7bnwBV iC1o7/eWs7mEKO0RIFUpdXiMbPB2cYWlcnpegJRjYuqMe6XyYvqpr9E8TNHpwZnbGv oTMiXHfhObT3A== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id EBC3AA0091; Wed, 23 Jan 2019 20:36:45 +0000 (UTC) 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; Wed, 23 Jan 2019 12:33:20 -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; Thu, 24 Jan 2019 02:03:21 +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; Thu, 24 Jan 2019 02:03:19 +0530 From: Vineet Gupta To: CC: , , , , Vineet Gupta , Alexander Viro , Subject: [PATCH v2 1/3] coredump: Replace opencoded set_mask_bits() Date: Wed, 23 Jan 2019 12:33:02 -0800 Message-ID: <1548275584-18096-2-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548275584-18096-1-git-send-email-vgupta@synopsys.com> References: <1548275584-18096-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 Reviewed-by: Anthony Yznaga Acked-by: Oleg Nesterov Signed-off-by: Vineet Gupta --- 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 Wed Jan 23 20:33:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10777817 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 054371390 for ; Wed, 23 Jan 2019 20:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9ABE2CAF5 for ; Wed, 23 Jan 2019 20:35:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD7C62CF59; Wed, 23 Jan 2019 20:35:39 +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 772662CAF5 for ; Wed, 23 Jan 2019 20:35:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAC368E0049; Wed, 23 Jan 2019 15:35:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A5B7C8E0047; Wed, 23 Jan 2019 15:35:38 -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 9238D8E0049; Wed, 23 Jan 2019 15:35:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 505458E0047 for ; Wed, 23 Jan 2019 15:35:38 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id q63so2605650pfi.19 for ; Wed, 23 Jan 2019 12:35:38 -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=KxWdOwMPjg+flSL9vY1TXEx2fKTnpU0iIdNL5rQ8Iuw=; b=OmQEFIB2mK+zAb9fB15QSQ+FVvhnCWKPzgaS10yW9li0UbQCn0qIj5gtj5U0BorqiQ dOkPkG5ssVS0VCF4Dx6tcfsPnh4bJtFVh7neQDdS5elq2NFtIjplh+RNXo8xnz7sR8VG X+uWl2AEgTl8r0wzWeAm1ICseDM2/To93wjP3rDNPNNcTvkVSbAIncZW8rokqpRELhbB Owbw44MI2h5fbQ/b5VBZJFHaMDRD2/6ph2qt0YhPuLLfmOMjgHGf58oAb69QXELtCsxF 2/ad/yWl84Xg5KAsrx2dfbWMW1M6KkFaOqghZaDOJv7fUdDB0MoxesMbomtKQxFO/AVl XuCQ== X-Gm-Message-State: AJcUukczDFHNavnGa1/VDiXtpffzkz6oKgqehNoYhH+sLw/Dx6iBlEE5 2AaJSPeAbiw0uIJ0iHETuiSCeiA4aohaJ9ZGjhusiFnKUVUUHPiEqCWyUL5Tb+RmPmiaLJDVPOM JuOG3aZXLjYPy90z7H9jrjoJ4KePZHhBWN/6iZrk/9Sbd3eHc50lazHFb/bE5VMuYaA== X-Received: by 2002:a62:345:: with SMTP id 66mr3493976pfd.189.1548275738000; Wed, 23 Jan 2019 12:35:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN6HhXAGuyVNaBrgfpStCeo07mE3FU/3BL8FgF0/Kh2JCQmrRfF6NdjDg21nb3Qbg04ekRF0 X-Received: by 2002:a62:345:: with SMTP id 66mr3493930pfd.189.1548275737410; Wed, 23 Jan 2019 12:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548275737; cv=none; d=google.com; s=arc-20160816; b=uYTbl6uGoO+9IE566SKKFK27ZVry1DvfuQRkiJjFspjtjuUOI3iB0Ts49r/0UH1fkN TEu6IUW4e6QkxIPOK/UH+Qb6y69F4NV58/AkfoZSJeNR4o+wLTAM5HeVHjNtz3vMC4vg 5NNnhEnamYn7mjUaxXJozyWT8jnAG0IRDGcvoWIAeccob3YinhCT+P9oPpukAy/5Wt8j sJKbzU4+zI4C2qQHaKN6kMxrVVa4dHRsGsquhzc/nuNaRp49Mw7yQmrNLuebk0Cr8epv JCElF1+D2ePh1NTDSVyxrm7KHtSgEuLyQE5/9FqVUpffTrfCMed8wZG0s5tgNZz7Lj/n QFRg== 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=KxWdOwMPjg+flSL9vY1TXEx2fKTnpU0iIdNL5rQ8Iuw=; b=yUE+oVEPAh1T3iVFpgpnXoxFrIwXcVyhRcJs19Y24e+yiRf6MbGVjjJ+/qJ7DME3lb OIj2WsWcuqYz9XlRqJk/4fxfR60fudYQCIjCqgoiOznw1Zmpd+fobZiPrJXS0TVLHoom 3Tso8YZpzLNQCdcbLxYN//MJdjAKk/NknmYir6dZdpCWnNEX/tToFlEiPFMqaviUQMef dXu/OklB0kzPZ7POpoa9KUz//RcpaLYOTGNjYdr0M2XvAUBFfl1thIasfOgI9YNBIUHD wVZzaVIha6hLrIWnTsisQ0ohJKct0Wq+GjjbAnAIxLciI+C1Pwo0uClpvlmxd5kRP+Py 1efA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=UwABq9HC; 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 (us01smtprelay-2.synopsys.com. [198.182.60.111]) by mx.google.com with ESMTPS id i64si20445115pge.361.2019.01.23.12.35.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 12:35:37 -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=UwABq9HC; 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 (dc2-mailhost1.synopsys.com [10.12.135.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 69EEB10C0EB9; Wed, 23 Jan 2019 12:35:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1548275736; bh=5aqJIt6TmksnMnFVKjXMkW1BGCYVhXZ+GYxGZlH9Bhk=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=UwABq9HCGrxzd0x+PMqCWh3JwQ7ooGkdnfoILCzSLZeKmLLWOybXyjeu61ecChbV4 yOVNQ2j3JajcEzlUejxh3MnFRNGqN6epSxutpCQ8bthEigufj6W+dhjv7o/twWGNL6 KHMwVKZk8a4m464p/oP5gR+/yLSTDc9uRgmrnmmdWvD9dg4nONK/v5Q0XtBoxP3c3V rY0ME/sobPY7eNFJkSZsoV1e8FADT0RbBpk6K5VtwA3Ii6FwFhuUg/2cHfuqn7TS3U UgbNeHlRzmC5dM436fX0f8VCZtk4DB+8zzOjcI5k1u4D1Y0KcVYiHm4CX1LMLr9Ga2 bw3jOmjcALOkQ== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 22C98A0070; Wed, 23 Jan 2019 20:35:34 +0000 (UTC) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 23 Jan 2019 12:33:23 -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; Thu, 24 Jan 2019 02:03:24 +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; Thu, 24 Jan 2019 02:03:22 +0530 From: Vineet Gupta To: CC: , , , , Vineet Gupta , Alexander Viro , "Theodore Ts'o" , Subject: [PATCH v2 2/3] fs: inode_set_flags() replace opencoded set_mask_bits() Date: Wed, 23 Jan 2019 12:33:03 -0800 Message-ID: <1548275584-18096-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548275584-18096-1-git-send-email-vgupta@synopsys.com> References: <1548275584-18096-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 Reviewed-by: Anthony Yznaga Signed-off-by: Vineet Gupta --- 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 Wed Jan 23 20:33:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 10777813 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 25A4314E5 for ; Wed, 23 Jan 2019 20:33:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081BC2DC10 for ; Wed, 23 Jan 2019 20:33:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA8FB2DBC2; Wed, 23 Jan 2019 20:33:33 +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 BA2F52DBC2 for ; Wed, 23 Jan 2019 20:33:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 779238E0046; Wed, 23 Jan 2019 15:33:31 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 728078E001A; Wed, 23 Jan 2019 15:33:31 -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 5CA438E0046; Wed, 23 Jan 2019 15:33:31 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id 17EEE8E001A for ; Wed, 23 Jan 2019 15:33:31 -0500 (EST) Received: by mail-pl1-f200.google.com with SMTP id ay11so2282154plb.20 for ; Wed, 23 Jan 2019 12:33:31 -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=v3jNlULmSE1VwiKJZu9XoB4X2QYGbn4gc7r4/sN0uaE=; b=UyKTCNP6U1deQOXefLjBBlCiJyrxTLcYuyeGOYo3E7ZHtefVzBTIG1KUmyz5lgo4Rg 6AzoEhAgICTkTMCSVDU8tZ2mRseRrQAQvjLI9BsxWR7buw5tEPVU09M4LCbbq8uTXWAM 9ywO/sgUQN7YAKUJNX6EWdpANAUMyijVrDeGTE4R2QDFkUcAr3DJHwHDIBzRJtlJxkeM x9UIY01LXjBUq3UPONY7j8JfvcjTdTwJXAuYO90F5k0YevxhlUssNfuS1h0GhJ/9ZYzY rVugdPSQHSK7sdVZT7PkYbZnAKvbohMbAfBka1JA69TNeisC+20/SJm2x0qIRBpUzXWd fa5w== X-Gm-Message-State: AJcUukfjrWvCy73ZOlnmzZeFQRL6ff8PrILGcdOsJJT4xNIstR+qxM5p k1jcQ/8qLuhIPHi4+yHAm/XYzzB2uuIgg/f8RLTRVKoCdr0As+Rfq2GYXoG8sXjReaCIDF1tO7C 9X6fwfOmmdG6Zpem2+N8Bi8DnBLle+bV5AkcaX0SjDNoVNt55+QWLW1lXG5skn58SVQ== X-Received: by 2002:a63:fc49:: with SMTP id r9mr3286592pgk.209.1548275610592; Wed, 23 Jan 2019 12:33:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN5cliLvG2K5/TcJxg/JmOIDiJlQBbvGmwEf266IJIbx+sG0umvHvf816X4gnxgFjO9KcYGN X-Received: by 2002:a63:fc49:: with SMTP id r9mr3286553pgk.209.1548275609883; Wed, 23 Jan 2019 12:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548275609; cv=none; d=google.com; s=arc-20160816; b=Xm8+8p/sH4TNxaFOakOFmBhd1soiI6e8I3RKagIDOGxVUk57hiKXW2DgT0NbgP/Puc t7Hr4IDYdo+CqQwL3l4dOq3bRaZz1XeImdFQmPX59eFtowSww/5yeP5eBEtc0bb8Duvx i2JoV9zs0guzgnJI/01s/9vfBx9sk8M7b/iVKRnWVjNgIg/1r6RVCRTBV+6TYj1QEDlB DEseoYd2fxxFw8/HawrDAe8Sm5jFFBPuwPA4Lib6JOO0gB2wogK7/KloJ9C+aOgwkeSp bkvtW+Y+43hfrvf9FkS2d7TDrpWays2e7WA8znxZZsRicYIWKIZ8Y1G4bT2dgfVGZRZV xCqA== 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=v3jNlULmSE1VwiKJZu9XoB4X2QYGbn4gc7r4/sN0uaE=; b=zlxs9quqklTQlSZQllJ8MssF+AFuwc1Stc9N5nND4hv92DOiyTh1YSmy49UP/z+xHa waJmYhjFEJBLeEjt9zaHA5cIhi6oj6JJfBnSaFyhvLOWWmkbrqDVk1fEnbWAhZltUwlG VhXE5gvo2TqIW9rxhXp8/o/wtH1+F4l0Xag1eJGgv6S65ZN3Tt6DHWOxBSkym3rI7It/ /LewBXMUrIDKcLQSuyw08ByN/rGFJXcypqy7RterNykVlwf8htvrskeKsQxqyfkV0qv7 71ecGhF/kqnFSGF3xcsEyvTuniJO+eNHS8873vttNl1QcXk5m0MyoBka3OKwNey7mCnW 3CEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=VCwEHtpu; 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 t184si19573706pfb.22.2019.01.23.12.33.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 12:33:29 -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=VCwEHtpu; 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 (badc-mailhost2.synopsys.com [10.192.0.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id BFB4124E08FE; Wed, 23 Jan 2019 12:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1548275609; bh=/YPzUCBU7GMseM6oGutvXPyXevw5WaEZWn2TeW3rLb0=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=VCwEHtpuLINV899uuD3C4uvwIg3nf3I66r7K0NjIWgk3/IIsqDYzJjrhU6Rqoo7Zh QPegu7LIcLeeQPWfeHoJUNic3qZxpPlMmIaibbNObQE2S/tYvtx/01U42BEBOkJKlh HUJmlEeR4SDC/TuNN1RJwppUYEQiIyhWIIqv95LpyHqFT+VVmpvffsyzTA8+L0NCwX uNHAUx4T/Iq6k29s4iYvIdtfo5LwBtRIi0pWzDt8WNw5y8l7FFX4DHWYY3oLcCAMgj hZ64fDEo+IfbFBe8NDaGsjxVSjTnSFCJhUMfokS/5JYqcLV0kZD4aXXv0UVYdA/pPG T1W+VLqargwgw== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id A765EA0066; Wed, 23 Jan 2019 20:33:27 +0000 (UTC) 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; Wed, 23 Jan 2019 12:33:27 -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; Thu, 24 Jan 2019 02:03:28 +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; Thu, 24 Jan 2019 02:03:25 +0530 From: Vineet Gupta To: CC: , , , , Vineet Gupta , Miklos Szeredi , Ingo Molnar , Jani Nikula , Chris Wilson , Andrew Morton Subject: [PATCH v2 3/3] bitops.h: set_mask_bits() to return old value Date: Wed, 23 Jan 2019 12:33:04 -0800 Message-ID: <1548275584-18096-4-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548275584-18096-1-git-send-email-vgupta@synopsys.com> References: <1548275584-18096-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 Reviewed-by: Anthony Yznaga Acked-by: Will Deacon Signed-off-by: Vineet Gupta --- 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