Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2481872ybi; Mon, 1 Jul 2019 12:45:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhiZhSWXw91LNKbzpg6/e4N7QVsaZMDPMg/DdGs5VmbbhDhOpDa/oLKag/DO23L86Ahs2g X-Received: by 2002:a17:90a:2567:: with SMTP id j94mr1044119pje.121.1562010342139; Mon, 01 Jul 2019 12:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562010342; cv=none; d=google.com; s=arc-20160816; b=piwM1Jy+99F/dyzngGEfsYyzBv9kG1kvlTBTxxkdDZ/OnwK11klxpinMOyMPLiTRDx q22aD5o4GdDRF/8nGFmsb7aF1ktTWjY5OQwx9lanrUh/jwJ0C2YUVOw+5gmr/b8NXBKr wk8iRexbnCkdip7sBYL1iv36IXJLmhwuPavnb0A2mdDlaLNaOC/5teykEoN1wnKMWY+W 5uSLcGGiNeWb/Noz3MEmAoUr7/GjFAJEP82Rv/xLIHoCvN9/ihgTaVFsCC22B3NcDYp+ A0SDhdoZJRfiySwuWbqVHRsasN/aPInu/f9UsUgifxgl/3viTQ5B7eCA4OIO7e3cmgTb peoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=au5bHTFzFyS+PnKfWAZmJzOM/aBWyQsp9x8rTigTLlY=; b=TyDxXCC1a7aG9E2DZOKyFMjmP9ROJdeeqR26PvgoohXgfHNSD5Xo0yQnT3MtIxOfOY mmKocsP9FGfOPXzCA1hk6fj9y8r84Ig6/VoI45fddMhzEkhNNggiM8pIjVL10je6mz/A FyAvOjx+QjK5m0RaORjEnQd0lTDvRhTcfnil+WJdW512Agt3+z1udPz9/5JjxEPeHG0n 3yUXDgpeHKMZb9QpxYNetW0WqaCJYqPU+LMe0HC+odTJop93jtdqEfaGSJ18Yh3Q/6V0 U1aRUSk/SJEzQ7qRaYxyLiTsJDybvEOSMGXVRtE992jJX6n220RCGfMIKgzl8fcASaOm iuYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lGdboEtC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j62si12115264pfb.272.2019.07.01.12.45.26; Mon, 01 Jul 2019 12:45:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lGdboEtC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726816AbfGATor (ORCPT + 99 others); Mon, 1 Jul 2019 15:44:47 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:45291 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbfGATor (ORCPT ); Mon, 1 Jul 2019 15:44:47 -0400 Received: by mail-io1-f65.google.com with SMTP id e3so31471252ioc.12 for ; Mon, 01 Jul 2019 12:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=au5bHTFzFyS+PnKfWAZmJzOM/aBWyQsp9x8rTigTLlY=; b=lGdboEtC8HEdmH1B/LWLni/Cqr0geuKsZamAD0yg3HRnx4a9P6fnOslhKVLyP1nBor MQxAbFQB/0VoCn340vrLbrDUS15lHm3cQ23cFn8FPjUCLMFxFmMbYQkIv34IrDqhiMpr znxksifhGACTACHTARKoSO7yk/Ny5iDKQzZmOBtBe5uDf32jwEz9xnhDyGtnEUJg7zkN DXl2gR+Sl+Oq8P0YH+Ku69ud5fAu5DpjfSgpRjHbg6abL1qdtZRcDKhmjBdW2r9Waj90 W+J7If66Pyc2Xwufjr4B4/lf+esLbDSpuO6HKhoWXn6/MOzsdNTujxQNYLjoi3Jv3Mm8 Fiow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=au5bHTFzFyS+PnKfWAZmJzOM/aBWyQsp9x8rTigTLlY=; b=d9HqKhRxaAjL7yZ8Vh/fz1+mwHq+M386C/p+tMdUc9EHs+g7BHj6qHx2R2mc5LdjJf mBNWmpjfEneY/RHKZiieEB4UGTO0OYb+1VEBHqUhXrfeRpWIUNEzEn85mv6srxlWptLn oSjY9OYNQnf5tKEWBBA8vBVjSMH8umpP6n9FNxwP5JlvqnuwAcgRy6IwyxJgtputMKft DbCLOk1d1l48A+8q9JYASgYL2atoApjiTjSxntuO85NnSQ5Xx+mSWOJ1VskDg2T4cmnN ECY9Jo4z9tQxtIzemvQpyWOg+ZhW3nBRRI7kzr+WxnZTDMcsQUGd6f9grwn7bzKf+7AR JjOQ== X-Gm-Message-State: APjAAAUmnRslzfS1hjCY3PVPnaNvWfSxyocrBYqf26jmUf0qqOes+T/j 3RrwnQhYknakMORuQPLQ0iFMj38chH3Qg4aF X-Received: by 2002:a6b:b602:: with SMTP id g2mr3718121iof.54.1562010285852; Mon, 01 Jul 2019 12:44:45 -0700 (PDT) Received: from [192.168.1.158] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id z26sm10564478ioi.85.2019.07.01.12.44.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jul 2019 12:44:44 -0700 (PDT) Subject: Re: [PATCH 1/1] sbitmap: Replace cmpxchg with xchg To: "Pavel Begunkov (Silence)" , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <722e1d561f0a49dc464d3a2b1be4c077f7502726.1558625912.git.asml.silence@gmail.com> From: Jens Axboe Message-ID: <77f4ee3b-a190-5708-f30b-0c5f2b933b3e@kernel.dk> Date: Mon, 1 Jul 2019 13:44:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <722e1d561f0a49dc464d3a2b1be4c077f7502726.1558625912.git.asml.silence@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/23/19 9:39 AM, Pavel Begunkov (Silence) wrote: > From: Pavel Begunkov > > cmpxchg() with an immediate value could be replaced with less expensive > xchg(). The same true if new value don't _depend_ on the old one. > > In the second block, atomic_cmpxchg() return value isn't checked, so > after atomic_cmpxchg() -> atomic_xchg() conversion it could be replaced > with atomic_set(). Comparison with atomic_read() in the second chunk was > left as an optimisation (if that was the initial intention). Applied, thanks. -- Jens Axboe