From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE55CC33CB3 for ; Tue, 14 Jan 2020 18:25:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A6FD22072B for ; Tue, 14 Jan 2020 18:25:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6FD22072B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 433C18E0006; Tue, 14 Jan 2020 13:25:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E47D8E0003; Tue, 14 Jan 2020 13:25:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D4AE8E0006; Tue, 14 Jan 2020 13:25:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 17ED78E0003 for ; Tue, 14 Jan 2020 13:25:18 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id E4C5C8248D7C for ; Tue, 14 Jan 2020 18:25:17 +0000 (UTC) X-FDA: 76377067074.10.stove84_2e2e45ec1885d X-HE-Tag: stove84_2e2e45ec1885d X-Filterd-Recvd-Size: 2488 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 18:25:17 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 2D94A68AFE; Tue, 14 Jan 2020 19:25:14 +0100 (CET) Date: Tue, 14 Jan 2020 19:25:14 +0100 From: Christoph Hellwig To: Waiman Long Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Will Deacon , Andrew Morton , linux-ext4@vger.kernel.org, cluster-devel@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 02/12] locking/rwsem: Exit early when held by an anonymous owner Message-ID: <20200114182514.GA9949@lst.de> References: <20200114161225.309792-1-hch@lst.de> <20200114161225.309792-3-hch@lst.de> <925d1343-670e-8f92-0e73-6e9cee0d3ffb@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <925d1343-670e-8f92-0e73-6e9cee0d3ffb@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) 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: On Tue, Jan 14, 2020 at 01:17:45PM -0500, Waiman Long wrote: > The owner field is just a pointer to the task structure with the lower 3 > bits served as flag bits. Setting owner to RWSEM_OWNER_UNKNOWN (-2) will > stop optimistic spinning. So under what condition did the crash happen? When running xfstests with all patches in this series except for this one, IIRC in generic/114. > Anyway, PeterZ is working on revising the percpu-rwsem implementation to > more gracefully handle the frozen case. At the end, there will not be a > need for the RWSEM_OWNER_UNKNOWN magic and it can be removed. Well, this series relies on that value. And I think it fundamentally is the right thing to do for AIO, and potentially other I/O related locking where we take a lock to synchronize access to data, then do I/O and then eventually get an I/O completion from an interrupt. Even thinking from the PREEMP_RT context we want to boost the initial thread as long as we can, then do nothing when it is off to I/O hardware (except maybe providing good diagnostics that the cause for the latency is I/O), and then boost the thread that is handling the completion. Things like the i_dio_count hack can't provide that.