Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp136042lqb; Thu, 23 May 2024 13:09:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWOxP3OwrWZIju3ekasNe2t8Tr9M69KqEJmeGF/sotc989upYEwNcHqcrCR7LtgwF7ax9+Dkwr/RmnqoiJYtcK3u/Zl8x6rB843+aoPcA== X-Google-Smtp-Source: AGHT+IEkBmkXUjV06V9jhSnHS8vmyJKsB2wtKvn2/wDyEAJflnj+iwiwY+l/jUm9D2bHAzI5Scrt X-Received: by 2002:a17:90a:c90b:b0:2bd:e32d:e6b6 with SMTP id 98e67ed59e1d1-2bf5e944b2bmr213998a91.2.1716494954121; Thu, 23 May 2024 13:09:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716494954; cv=pass; d=google.com; s=arc-20160816; b=mzMCRXchoWDhzhckw138QOhHi3PcLilq3murZ+s2bNumXZCZIxLGIz4yVxjE5CY1Mt GeOfp+a0QdSKcx4+/DEy/M9i4wQZ9NpZPGJbJXZOOJ6F+e0oM9vJTqK8mVQLO5YhpLY5 7RV7pN20EI/HeEOVPO0zLK+gSm3G2iiLO8WCt43laQaM1o8J1REDI+ywy+4FQMmrL2EH sa+95alA/9NZ5jwlkstCBvB+KlAwrg+DG1fDtMCGDuCHPktVrCGDDkFy5M2/lPVJEXKG wVjduaYhDkyrCSlH6qB4dJXap+ycYRshk9eDQ0yDHGQq5wF8rmtCxPQ0aN1XajHFIt1F Rwtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Smq5jJHzL2mlUDsOS5EkUOdfEmOIG4oMVUVuSCQn/TU=; fh=wmNkZNGI8TjIc6+x/hEaNAazmVUfggYaHaIDR1HZ3nI=; b=GJg/4UzWf6YyLC3CIUwQBvmseW6cy+DgK6uHm7wRvpNLH9lN0kvZQRgNryb61ioipc jwH5CPv09lUiWQbed31J3NuFQ1krwznFn2WQ+KhTa+F3b4qy7qfzksV6QocgdvL1bi4o QC03M6p1+O3ccD5ysJ7oHra8+ts9/RO3xnaWBE1CGxW1KpNb6tjkeUyJ9YsrVyvDkzta BoYCbkNVPp22+sBV65VhapFdK78bBGd1nyAhhb4IUGPaFVrY6YOzyV6vE+D8WuQde2/3 biOuNbioLP5k6q8ybqCDAzTEEYEaigUo8/aUA+j338Y2Tv60p0UawVqxOV70iC2MKKp5 xRJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=wlhqS0gX; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-187957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187957-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdd9f4d88fsi2032492a91.124.2024.05.23.13.09.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 13:09:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=wlhqS0gX; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-187957-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187957-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 223B1B2322B for ; Thu, 23 May 2024 20:08:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D20D84D04; Thu, 23 May 2024 20:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="wlhqS0gX" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6C7157CF30 for ; Thu, 23 May 2024 20:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716494883; cv=none; b=KLF8i9RetmWPJWluHXeyswe/xLE0zazR8rscTZ9d7GpSUjGTalKXyqyDcGngASrugznzjZKu/FllcHdCbaVai3h8k6hPHTmDNSiII5xxnxicPwH4LkYMPwl3502HVDtVCOzEJz1jWVRakgwTbs5tugzQL+8wacScmDwvRwGTBwE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716494883; c=relaxed/simple; bh=mE9GWyj51oGut1mjO8n80AtwQWmF6uIioAuY8hoSOPw=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=TQOsuo5HW3ajmA6kIefqXnqHyiAspdbWB+hTopfaUhnyeJjWqSVwj1To/iWvFai/v9GrNZqKpDeSig2RMjQt2/uZfskds0YMo2Yp9tIbPOUHE5xv6oKcB9iQphCNU77d0vePi3T0JYH3VT2RyDpWFZiskzfqOdFw6ImU3KgBvKc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=wlhqS0gX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB994C2BD10; Thu, 23 May 2024 20:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1716494882; bh=mE9GWyj51oGut1mjO8n80AtwQWmF6uIioAuY8hoSOPw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=wlhqS0gXja1OKD10IEBjBj2ZQglXL0cw+BAMcoO5G9JKX/C4gT+KCWCkVPPc1NO7G bOTDh3jR/ProFCwHsfh060UqUnDHdzqrEICZ9dvR65h120/SPICAFTIO7g7R9CPQrP nkWOXxUWYHNMqrN0MOFriJZ9TOQoxJZ0RJPOMw1Q= Date: Thu, 23 May 2024 13:08:02 -0700 From: Andrew Morton To: Liu Wei Cc: willy@infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/filemap: invalidating pages is still necessary when io with IOCB_NOWAIT Message-Id: <20240523130802.730d2790b8e5f691871575c0@linux-foundation.org> In-Reply-To: <20240513132339.26269-1-liuwei09@cestc.cn> References: <20240513132339.26269-1-liuwei09@cestc.cn> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit 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?