Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1065722ybl; Sat, 18 Jan 2020 17:58:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyMbKckgMDvMQzDdiSl0ZklR2uhTRxZQYA93BcikT8FyOzYP9gzbP8tZFKX9ut2qbCKaqFw X-Received: by 2002:a05:6808:c:: with SMTP id u12mr8718163oic.107.1579399097747; Sat, 18 Jan 2020 17:58:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579399097; cv=none; d=google.com; s=arc-20160816; b=C4QCg0xOTqgIkIX9Fa+Cd4ja6L/+aU3VaCuaNy5y/vVp/Wkjd6neQrsyEZU6UeZ4dy Fv2QnCSY6BG7ibtZUWUwhb2FSXwToRWV1CCCvC3AArTlbRNFUFBMgrMUPzuyUKoDIBrO wIAzi9U9cRrco6/dXi1Jsf/S+yC/5jO7p5ZH+Dov5ocqDUtudzxBcAs1DkmZMR5QpGr4 vEOPzY6ct5KxDmyr5jYOzZpTuYr5rtswwBTO6+g5Azxo10IwEKELOilPXeIYLpEOVWYq Kwgf+Unq6xSDRUrx9hzbGl1vMinjIh9DpDppox9foteBUqkou6BmAMtabRwmSNUAoqZr nbSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=EpTDqwvrLINQPe1SRVTyiVLNmC8d82BuEpAelN8lzSA=; b=y+l7SntQIxhzeSFs+hD20x7VT2Glbhg8JEujQaFKHzTtnlnQjsEAYhU2qSE6sU/R9X jnqGptpBWoa1Yfrtqi+OUKQYDcF93z6SFEj6sUaBYpQz0QHyCavy5vFZdzURw3wT39Pi yytlRPRc7114HnjLIh0ZPHnP8mqN2O60LAuz7R7BmR4qEKacPwfxCkuyaw5xscmfdPMM TC1CCwKxCkBcP8urITqqJg2tJTKWuF4v9SMOLaaongbIka0jUbN325Y1+ww3mYPCHII0 jKmV08/Gm6e2UGoHrpDzFpBMIM5rKXjy0a4+Fakd063ZKHmLg6mONY5y41vlx/FWpTin FOdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w131si13764466oie.47.2020.01.18.17.58.05; Sat, 18 Jan 2020 17:58:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727325AbgASB5N (ORCPT + 99 others); Sat, 18 Jan 2020 20:57:13 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9658 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727083AbgASB5N (ORCPT ); Sat, 18 Jan 2020 20:57:13 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 40710B6CE2308EE686D5; Sun, 19 Jan 2020 09:57:11 +0800 (CST) Received: from [127.0.0.1] (10.173.220.96) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Sun, 19 Jan 2020 09:57:05 +0800 Subject: Re: [RFC] iomap: fix race between readahead and direct write To: Matthew Wilcox CC: , , , , , , , References: <20200116063601.39201-1-yukuai3@huawei.com> <20200118230826.GA5583@bombadil.infradead.org> <20200119014213.GA16943@bombadil.infradead.org> From: "yukuai (C)" Message-ID: <857fa4e7-c529-40cf-9916-151d91e815c4@huawei.com> Date: Sun, 19 Jan 2020 09:57:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200119014213.GA16943@bombadil.infradead.org> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.173.220.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/1/19 9:42, Matthew Wilcox wrote: > Did you read my patch series? The current code allocates pages, > but does not put them in the page cache until after iomap is called. > My patch series changes that to put the pages in the page cache as soon > as they're allocated, and before iomap is called. The current code to determin if page need to be allocated: page = xa_load(&mapping->i_pages, page_offset); if (page && !xa_is_value(page)) { /* ??* Page already present? Kick off the current batch of ??* contiguous pages before continuing with the next ??* batch. ??*/ if (nr_pages) read_pages(mapping, filp, &page_pool, nr_pages, gfp_mask); nr_pages = 0; continue; } page = __page_cache_alloc(gfp_mask); if (!page) break; Page will be allocated if the page do not exist in page cache. And I don't see your patch series change that. Or am I missing something? Thanks?? Yu Kuai