Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4646964rwd; Tue, 23 May 2023 10:20:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XefOhC9qdvIV3QhFBJkCmtc+3om1BTMqKljTWjAi+rguxy5mdmT6+Pg5YBg+Cvt7lYVN1 X-Received: by 2002:a05:6a00:181f:b0:643:2559:80f3 with SMTP id y31-20020a056a00181f00b00643255980f3mr25809033pfa.2.1684862444168; Tue, 23 May 2023 10:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684862444; cv=none; d=google.com; s=arc-20160816; b=mzKD2le9IU7aTXYSysu5jAE7UG/1HUNpYjwxv07OpOx4Tschh9tEQmT2NXWBEfiVmJ yvCRP5ZLLm9ZrUnLvm2rOFbnueQl2K8MDSc3JPNK+W5WDC4Xf/IuSoZYGeRJ7+w3x6Ug P4GnYw5WClzQJKkvs7OxlrXkRRZMNCUWumcHrmNbsfOXT9Bpu97A0/Zq5mfvTS3HLrwH SzpcyUXzNGhSrdXtkBCpxIgRStl8yX0wS7JkZpAOu+u4IJw8OQn5vSOCtGlCMYYWV3TH Pvx1aWkR19Feo21X9wV+l/0h3CUnE8h3dUfDYCwsmCyOQHTvD7ZZisc9e3cjb8i9MIr2 p03g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=G5nor1odEvltlOg9yz8O08fTQiIli5/Sp675o7e3SQw=; b=hNZFWardRALGku+CsD67/Dh9dcLJloImAdljg2uaMn6svKBw8tMD54TKr590dvcIgA YKsueb5Qv5dDZZJ/LQH21GgFh2oMLyML2ah4OcG7tLUO7USee3kCpIauRxgJ6d1IaAB6 JLVhzwj5tzBwsCUo/ng46jAeyKmtaiiIDyD3v3LwqagCttqzHti3vpFPfJ19KnjnTuXJ CCPI8jnl8mGhJxHx/bFrUVpQlnVC6EQnc7LJJd7Uccq4Y9TH0x2PSGueER1CxF9EX76L dv2JNo4sICNXs9DmrDTtPmeJ26YPAjXrnRxgtJoI9Kou1hMRJ/GrQ+8M1HvfMLwkkovu JJRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dE7DP+Zc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s188-20020a625ec5000000b0064ca7ac8938si6857597pfb.166.2023.05.23.10.20.32; Tue, 23 May 2023 10:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dE7DP+Zc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237814AbjEWQtR (ORCPT + 99 others); Tue, 23 May 2023 12:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233485AbjEWQtN (ORCPT ); Tue, 23 May 2023 12:49:13 -0400 Received: from out-3.mta0.migadu.com (out-3.mta0.migadu.com [IPv6:2001:41d0:1004:224b::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71842DD for ; Tue, 23 May 2023 09:49:11 -0700 (PDT) Date: Tue, 23 May 2023 12:49:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1684860549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G5nor1odEvltlOg9yz8O08fTQiIli5/Sp675o7e3SQw=; b=dE7DP+ZcesSaqKf/vGAK7JJ4yjJ//Milpfy6z8dTQLCfoYuvrp6e6BO/FxXZNN9UvCiDiY po8NPW1Lh4CONt501RR4qnXT19OvGnUsfVW7bmT9oXNXE9hP39nES7ra0jumcGnzf8cDZV ATZZtAEExaVzRfglCjVePA2yubgNfwM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Jan Kara Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, Kent Overstreet , "Darrick J . Wong" , dhowells@redhat.com, Andreas Gruenbacher , cluster-devel@redhat.com, Bob Peterson Subject: Re: [PATCH 06/32] sched: Add task_struct->faults_disabled_mapping Message-ID: References: <20230509165657.1735798-1-kent.overstreet@linux.dev> <20230509165657.1735798-7-kent.overstreet@linux.dev> <20230510010737.heniyuxazlprrbd6@quack3> <20230523133431.wwrkjtptu6vqqh5e@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230523133431.wwrkjtptu6vqqh5e@quack3> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > No, that's definitely handled (and you can see it in the code I linked), > > and I wrote a torture test for fstests as well. > > I've checked the code and AFAICT it is all indeed handled. BTW, I've now > remembered that GFS2 has dealt with the same deadlocks - b01b2d72da25 > ("gfs2: Fix mmap + page fault deadlocks for direct I/O") - in a different > way (by prefaulting pages from the iter before grabbing the problematic > lock and then disabling page faults for the iomap_dio_rw() call). I guess > we should somehow unify these schemes so that we don't have two mechanisms > for avoiding exactly the same deadlock. Adding GFS2 guys to CC. Oof, that sounds a bit sketchy. What happens if the dio call passes in an address from the same address space? What happens if we race with the pages we faulted in being evicted? > Also good that you've written a fstest for this, that is definitely a useful > addition, although I suspect GFS2 guys added a test for this not so long > ago when testing their stuff. Maybe they have a pointer handy? More tests more good. So if we want to lift this scheme to the VFS layer, we'd start by replacing the lock you added (grepping for it, the name escapes me) with a different type of lock - two_state_shared_lock in my code, it's like a rw lock except writers don't exclude other writers. That way the DIO path can use it without singlethreading writes to a single file.