Received: by 10.223.164.221 with SMTP id h29csp2221703wrb; Mon, 23 Oct 2017 03:31:33 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SjptXBGK8KWCibrJM19gMsgA2n2WT0SOoafpenMeI+e3VmSllHMAM1KjWbhuke9B1ieieM X-Received: by 10.99.62.207 with SMTP id l198mr11169310pga.376.1508754693417; Mon, 23 Oct 2017 03:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508754693; cv=none; d=google.com; s=arc-20160816; b=ZuIctkr5+Yv3HLvP2U88BpOMZh7C5P/bGQt4Pov6MDmysNQ0y719hwWt8wDvDiF2UJ c2ENKIR2EHKhLBK4BpEwXePp+qbPBcLV7guEN5fvYcki4/Uk27qrIY+ohY9+ME8fuMA7 NqmOKxJJaK7+F+FTVKbcK7vO1QRUtNSrL/n+8ZQoHpjInNcinXfLvkRsTWm7Ns43DxCx nivlrG6h03Bq/rOrC7GnJbqfLOVlAv9MMjl0aztOA18ZgIJeVO1yTMh92Fm9tEujRQCc oSoEUBKff4wOrgY1pHpHe/WE6XV2bgchGY7e8JTbYF5lJQSaGQltNpJ/oCQzOr75U4hN +2fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=7zYVSGhBOD9HTc69tOt8l8+/N3IregIlbP/hVO/5t98=; b=GRgZ9mBmWiPJD2uCWiPNFKrlGEomNdTHE9VcH38J+cPojKzlWGrKcO96U6BWq6pvOr JIo/nCouNylEnoEnu/zUysPmhb9hT086KSIRlbat2yDvFRzNvzgtS5/nAJ2oM68spxYe NhDrcwRNAmKX71t4OISO5WUf102HSFn4dAVdVtdI2PuDbGa+PI4APEmH9u+r4PKDk3XX sBfEAUrD3ME3+sSpooZej5xUMpUpk1rQGC71boMwXnxEHVH9uXBGHmij/WZ04RGzFCqT 6CKTAHs1sQwQOBCY/7Mo7RWXPKCIS+lQkthRA5C+c3qQA0nHvyX2gGQVfD2hzqwToLUC jY3w== ARC-Authentication-Results: i=1; mx.google.com; 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 z14si3877753plh.282.2017.10.23.03.31.18; Mon, 23 Oct 2017 03:31:33 -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; 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 S1751630AbdJWK35 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 23 Oct 2017 06:29:57 -0400 Received: from mga05.intel.com ([192.55.52.43]:47607 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbdJWK3z (ORCPT ); Mon, 23 Oct 2017 06:29:55 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 23 Oct 2017 03:29:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,422,1503385200"; d="scan'208";a="1208907906" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga001.fm.intel.com with ESMTP; 23 Oct 2017 03:29:53 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0319.002; Mon, 23 Oct 2017 11:29:52 +0100 From: "Reshetova, Elena" To: Dave Chinner CC: "darrick.wong@oracle.com" , "linux-kernel@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "peterz@infradead.org" , "keescook@chromium.org" Subject: RE: [PATCH 0/5] xfs refcount conversions Thread-Topic: [PATCH 0/5] xfs refcount conversions Thread-Index: AQHTSZTUz9fYd2XtRkWKd616yhL5h6LtUE2AgAPuSiA= Date: Mon, 23 Oct 2017 10:29:51 +0000 Message-ID: <2236FBA76BA1254E88B949DDB74E612B802B436F@IRSMSX102.ger.corp.intel.com> References: <1508497678-10508-1-git-send-email-elena.reshetova@intel.com> <20171020232111.GT3666@dastard> In-Reply-To: <20171020232111.GT3666@dastard> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzA5Yjc0ZDktZDAzNC00Y2I0LWI0YjEtZDQ2Y2JmMjI1OGUzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJYRUtVUzd1OGZOQlByWDJpQmdOZkxlNFExWWd0aU5HY296Vlo1c1FDQzVCRHFiQmYycFFGaVVtVFk1YUsyNm5aIn0= x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Fri, Oct 20, 2017 at 02:07:53PM +0300, Elena Reshetova wrote: > > Note: our previous thread didn't finish in any conclusion, so > > I am resending this now (rebased at latest linux-next) to revive > > the discussion. refcount_t is slowly becoming a standard for > > refcounters and we would really like to make all conversions > > done where it is applicable. > > In a separate "replace atomics with refcounts" discussion, the > ordering guarantees of refcounts was raised: > > https://lkml.org/lkml/2017/9/4/206 > > i.e. refcounts use weak ordering whilst atomics imply a smp_mb() > operation was performed. > > Given these counters in XFS directly define the life cycle states > rather than being just an object refcount, I'm pretty sure they > rely on the implied smp_mb() that the atomic operations provide to > work correctly. > > Let me put it this way: Documentation/memory-barriers.txt breaks my > brain. > > We know atomics provide the barriers we need for the code to work > correctly, but using anything else requires understanding the > ordering of the new code and what Documentation/memory-barriers.txt > says that means. > > IMO, that makes it way too hard to review sanely for code that: > > a) we already know works correctly > b) has guards against reference count problems; and > c) isn't performance critical, so doesn't need the > complexity of tricky memory ordering and/or barriers. > > So, really, it comes down to the fact that we know refcount_t is not > a straight drop in replacement for atomics, and that actually > verifying the change is correct requires an in depth understanding > of Documentation/memory-barriers.txt. IMO, that's way too much of a > long term maintenance and knowledge burden to add to what is a > simple set of reference counters... Fair point. Let's see if we can change refcount_t to provide the same memory ordering guarantees as atomics. Then you don't have to worry about things like this. I think this initial idea behind refcount_t was a straight replacement for atomic_t reference counter use case plus a number of clear and understandable security guarantees (like overflow protection). It was indeed not supposed to make a difference in any *other* ways (and I think in most of cases it doesn't even in the current form). But it is indeed easier to just make it provide same guarantees on ordering vs. trying to check every case (and make sure future users understand this too). Let me be back that we have a joint conclusion on what to do with memory ordering. Best Regards, Elena. > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com From 1581820705243234799@xxx Fri Oct 20 23:22:59 +0000 2017 X-GM-THRID: 1581775102950037022 X-Gmail-Labels: Inbox,Category Forums