Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp252439lqb; Thu, 23 May 2024 18:00:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1SHqaXAH0EWBQAbcCfX2kz9mZEGgowuRWbQ5TzFjr3jrNp1oW6A96XcqzPAz1/LoVvYNzr7HxDysyDUklv/MHoUcY3FrgqkY+4nGlIw== X-Google-Smtp-Source: AGHT+IGOz0Lz+ja5HbGjwqd37R6/vgqJSiexz6MzmNrFyN7+2dV5nEIJtvQM2xjqcIedvYd187HK X-Received: by 2002:a05:6e02:16ca:b0:36c:817a:2a80 with SMTP id e9e14a558f8ab-3737b25d362mr10181575ab.9.1716512445308; Thu, 23 May 2024 18:00:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716512445; cv=pass; d=google.com; s=arc-20160816; b=jNiqHyRUiMs8wi/s7DpO1omfoFW1HLHG4dEv3D7ffGGzsHW13dy3bJODJxg2hwtIxn KHKKAy+6HqhOcrFfmC0grMMlvdiG5wA+9lP+2ZxlVlYumLxqh78EFjnj+al2C4nNNoAF 7PU6IH7tWT1oBjWcflCl9Bwg0t5iGP2ibWbt3DWxg24+bX5TEjwWrbu0vk1dddwHTaUS GpcaLRUrfnze8oUZ9xiJQE11Df7yX641rQKpCkpij8CEvHxqcQaKOgRM1iQv1vTYi+Zj dTNoa9ywXHKlzJlCzSQYUHBDkW34FjHBZfVmA0EPblNwRuG40SLr3crT8jTgun0iI5kA f/2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=r87UAbK+4R52aZiqOZBmOZr7m2+QGycYejcygFi33ow=; fh=NUW660X77Gslowj4lnR1RFtd+oaFQ/+f/wpcdWqYM/g=; b=NCRewHjtFeOoAxp5bdR3DI0LcM9Nu6QURFuQecu+4EBk2srQZgZFCIQyynkNMUd7l5 tN94wp8ciPT7RzIcXuPccKnTBlPjMgy97QsxWzo+rADp4B2JpC39D3oDDHaPhnepOepW e+i555imQsWN/WDSp3wQ32gICfWj25Gzwk5MovLEPGcqIozlcIa/JUSN9um1D1a/cIhj 4KvV5XBFYO2DlPnEj4fuYUF51N9WU1jRR28SkxJCMByxPOyChp8OtBapoBfGxnAU6hVY 86OMd2MN6GBOd1R8nrD6MzUjZr32m0TulJYBCTYEUMmG5YxFLCsMU9Fwj0hQ5gDO8Uy5 56Tw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tsLUPJLS; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-188007-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188007-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6822a98e6e7si262965a12.760.2024.05.23.18.00.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 18:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188007-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tsLUPJLS; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-188007-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188007-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7240B285140 for ; Thu, 23 May 2024 21:11:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB0F5127E11; Thu, 23 May 2024 21:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="tsLUPJLS" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38C7384DF0; Thu, 23 May 2024 21:11:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716498669; cv=none; b=OdSI7+hEaDOkd/pcr+docMFmA+7YX0cT9U8ERHOnFJK1MLelmmIOdplsqxV+/c8h68Boz+Qe1KvkRmPoKFIpEacVlwl/a/0CpsRHco+u9x8pRIiGFtXG/q9CL0EbKpvdUWce5R95D3Dp9GM8rs8+mo/AzEEqF2hv7IAWUAHCVL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716498669; c=relaxed/simple; bh=U3AgHnBZpyYL5qEMXNzACcVIILK+NSDoYAQQlQadUCs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fTrFpHS1YSkqxycM7ba5Pu0VqYavYVZJvGms4PICctOnuzXTDc67FM791X0DbcLuf7q0o2qmKDJU7N6KQlkkNa5g3hQpV/gx6uDDpwf3KPUrPX7uJAEjKf32UMtJxmzdMwkzwyx/UsH2u3MWgv5kS3IptQ6Rpfd8e9FXWX0Fd+4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=tsLUPJLS; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=r87UAbK+4R52aZiqOZBmOZr7m2+QGycYejcygFi33ow=; b=tsLUPJLS2N3rALCVwA2t6lT593 GD9cL90LgdZ2ePs9mg6ccCGkeWTQKm/4zBpsKNbwQjQJND5c26fJEDYFM6WCCcqNKB8CMn44IlHSb 09+dQNAG1HHBXx2CXo8kggBRpF0bbczK6BwJQhnFPR1jdGV6dG2tGujk980glw2N/sJuCCMedzrnp yreRs95Xcn15oYfdgVfk/kdoUjyslT4tGI6SUrO7M5kUOd1BQG1ZoLXK9lhfLEQD4L94kMeHDSarJ 26iy+Y39Z6fdq/6gNZrq0vOBDbj5t4le2d38JaAXCyUu15zIEYJq6Y6MoZSFeTS+MKaYUUjoPXbFt p13WMb6Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAFiI-000000026LH-2V56; Thu, 23 May 2024 21:11:02 +0000 Date: Thu, 23 May 2024 22:11:02 +0100 From: Matthew Wilcox To: Andrew Morton Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Goldwyn Rodrigues , Christoph Hellwig , Jan Kara , Jens Axboe , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] mm/filemap: invalidating pages is still necessary when io with IOCB_NOWAIT Message-ID: References: <20240513132339.26269-1-liuwei09@cestc.cn> <20240523130802.730d2790b8e5f691871575c0@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240523130802.730d2790b8e5f691871575c0@linux-foundation.org> On Thu, May 23, 2024 at 01:08:02PM -0700, Andrew Morton wrote: > On Mon, 13 May 2024 21:23:39 +0800 Liu Wei wrote: > > > After commit (6be96d3ad3 fs: return if direct I/O will trigger writeback), > > when we issuing AIO with direct I/O and IOCB_NOWAIT on a block device, the > > process context will not be blocked. > > > > However, if the device already has page cache in memory, EAGAIN will be > > returned. And even when trying to reissue the AIO with direct I/O and > > IOCB_NOWAIT again, we consistently receive EAGAIN. > > > > Maybe a better way to deal with it: filemap_fdatawrite_range dirty pages > > with WB_SYNC_NONE flag, and invalidate_mapping_pages unmapped pages at > > the same time. > > Can't userspace do this? If EAGAIN, sync the fd and retry the IO? I don't think that it can, because the pages will still be there, even if now clean? I think the idea was to punt to a worker thread which could sleep and retry without NOWAIT. But let's see what someone involved in this patch has to say about the intent.