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 F1DE4C33C9E for ; Tue, 14 Jan 2020 18:25:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6B712072B for ; Tue, 14 Jan 2020 18:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728882AbgANSZR (ORCPT ); Tue, 14 Jan 2020 13:25:17 -0500 Received: from verein.lst.de ([213.95.11.211]:47259 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728779AbgANSZR (ORCPT ); Tue, 14 Jan 2020 13:25:17 -0500 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) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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.