Received: by 10.223.185.116 with SMTP id b49csp866325wrg; Fri, 23 Feb 2018 08:02:21 -0800 (PST) X-Google-Smtp-Source: AH8x2270Qo/As1RjKwpSgk7O9StdpCIW1J29LgPzS8+Jaia6r61dIlpcvtyQvfvURUhF/4CTAxdo X-Received: by 10.101.98.85 with SMTP id q21mr1783961pgv.182.1519401741185; Fri, 23 Feb 2018 08:02:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519401741; cv=none; d=google.com; s=arc-20160816; b=jsR9b78OjEP+YiXzQD+MzRsl7x5r0bC1Po3CG/zBhckc2ImQd+7Jujvu/MafoAnJGS 64BHY7qTP+XvDNh/lRSTYT3cuIToADHZNf+U67qFpJvAwXWQ+fbqYHv2p7fYejJSlejw 2EGlUXsU0M3PTvR7JYRt0haV/rEpmspILGVCO6UlJGYKW7ul1mTTE/qCK22oUow7lfeT /rnkqJSGbttADbRyDLVcZLASsVlYZYiRuWtXCAOH4zifyAy8ZxwqdcyB5jg6YYfe2kZN JmpE78U+B75Uls/Qan1m9iQ4wCwiP8VGJ4h8azvob4vG35QoztALeKSkrLZqtjyCZHvg PtAw== 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:cc:to:subject:arc-authentication-results; bh=5oB3pxH5L3lx+331QdJojPLrOs3uZ9C+T6i71Imic30=; b=CzAh3/8ZAs1RVPMnVhZ+3G0/1Eonl6NvwhvE4Z4z3tvgccSl13Le44CL5d+Rg7d88M nV4HU8FxTFtHUa0GBAn9Fdzqc8gvnbiWPhNid3UdVmCuuMW2SsiN7hP+/Qip0po3auoA 4wK5NyDhFo+Vu19kruh4YQ/fnxmdHKccOpGlkyZlmaGLUEaE7aJZcOIjCf0UKZtpJsUL Ktqb0aR+QAsEjrtccyQJsQ/datYYGkknVGpCbcdtbxirmilBDzEpB1TxeDt9YzQdYkbV UpxfDlVcklDSvLhcYMGhVbB7CDtNp0wROsFedKoC+s+PLm9iICQTQWCTbUVNJlhoDQfv MAMQ== 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 g2-v6si1963771pli.637.2018.02.23.08.01.55; Fri, 23 Feb 2018 08:02:21 -0800 (PST) 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 S1751846AbeBWQAH (ORCPT + 99 others); Fri, 23 Feb 2018 11:00:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:48858 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbeBWQAE (ORCPT ); Fri, 23 Feb 2018 11:00:04 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7433EAD95; Fri, 23 Feb 2018 16:00:03 +0000 (UTC) Subject: Re: Reasoning about memory ordering To: Alan Cox Cc: LKML , "Paul E. McKenney" , mathieu.desnoyers@efficios.com, Peter Zijlstra , parri.andrea@gmail.com References: <0db16ef6-c805-b1f6-527f-8fec149e3df5@suse.com> <20180223153807.64666cfe@alans-desktop> From: Nikolay Borisov Message-ID: Date: Fri, 23 Feb 2018 17:59:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180223153807.64666cfe@alans-desktop> 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 23.02.2018 17:38, Alan Cox wrote: >> Given this is the current state of the code (it's part of btrfs) I believe >> the following could/should be done: > > Is there benchmarking data to show that a custom lock is justified > (especiaally given it's going to mean btrfs and rtlinux don't play > together nicely since it won't be able to see the mutex lock and do > priority boosting ?) No, unfortunately this is not code that was written by me. I'm just arguing it's not entirely correct. Generally in btrfs we'd like to allow concurrent DIO read/write accesses to unrelated portionsin a file. Hence I can't just use inode_Lock (DIO writes are synchronized with inode_lock). Also I cannot use inode_shared_Lock to synchronize multiple DIO reader against writers (including truncate) since this tanks perfromance and I already tried[0] this approach and received a NAK... [0] https://patchwork.kernel.org/patch/10232015/ > > Alan > > >