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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 7808FC4320A for ; Mon, 23 Aug 2021 16:07:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B1FA613DA for ; Mon, 23 Aug 2021 16:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbhHWQIC (ORCPT ); Mon, 23 Aug 2021 12:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhHWQIB (ORCPT ); Mon, 23 Aug 2021 12:08:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314FBC061575; Mon, 23 Aug 2021 09:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=LsLe+48Z44OPP+wxVpkLam4RDFITz1Wr1Njeq/MH3xQ=; b=JIER7PcfVkmzObvzVJKjAthV5J E58VcBuoRhT5QN3utOlLgU0h4dICVnkvP+2sJoeUTmFaxW5EuX1ZeSd5fqAs34wDtct92yhVJNRTZ 02+D635L50Gs9s5wVv1M3KuG6Akav4/TqFNyGRbNWE5EmIY7zGB3hRksLg1V9M0iiBzKnUlu62DGo BRzerZi/G2Hay+e9LYV7XY9WrKGmurqghmr8+6TOX9BahA7JKurkZawstXTJLRF2V/GA1R/5txpGt ODYCJevsYllGgbsS5Bh/Edi+NsPIuVy/Ba8ykOPZ6VmqG1VxdO0AhEfh9Ey2Jn8ehaPD2lt8bqq5t o+C5OFyQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mICRz-009vvg-D4; Mon, 23 Aug 2021 16:05:34 +0000 Date: Mon, 23 Aug 2021 17:05:27 +0100 From: Matthew Wilcox To: Andreas Gruenbacher Cc: Steven Whitehouse , Bob Peterson , Linus Torvalds , Alexander Viro , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , LKML , cluster-devel , linux-fsdevel , ocfs2-devel@oss.oracle.com Subject: Re: [Cluster-devel] [PATCH v6 10/19] gfs2: Introduce flag for glock holder auto-demotion Message-ID: References: <20210819194102.1491495-1-agruenba@redhat.com> <20210819194102.1491495-11-agruenba@redhat.com> <5e8a20a8d45043e88013c6004636eae5dadc9be3.camel@redhat.com> <8e2ab23b93c96248b7c253dc3ea2007f5244adee.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 05:18:12PM +0200, Andreas Gruenbacher wrote: > On Mon, Aug 23, 2021 at 10:14 AM Steven Whitehouse wrote: > > If the goal here is just to allow the glock to be held for a longer > > period of time, but with occasional interruptions to prevent > > starvation, then we have a potential model for this. There is > > cond_resched_lock() which does this for spin locks. > > This isn't an appropriate model for what I'm trying to achieve here. > In the cond_resched case, we know at the time of the cond_resched call > whether or not we want to schedule. If we do, we want to drop the spin > lock, schedule, and then re-acquire the spin lock. In the case we're > looking at here, we want to fault in user pages. There is no way of > knowing beforehand if the glock we're currently holding will have to > be dropped to achieve that. In fact, it will almost never have to be > dropped. But if it does, we need to drop it straight away to allow the > conflicting locking request to succeed. It occurs to me that this is similar to the wound/wait mutexes (include/linux/ww_mutex.h & Documentation/locking/ww-mutex-design.rst). You want to mark the glock as woundable before faulting, and then discover if it was wounded after faulting. Maybe sharing this terminology will aid in understanding?