Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp37616ybv; Tue, 18 Feb 2020 17:13:41 -0800 (PST) X-Google-Smtp-Source: APXvYqx3MkuFIUESZjjUE5VipsMGGadSMoXfbQ+2/Y+XH6aDpTDtVbfviAouC1bd/J9dU8il41Pm X-Received: by 2002:a9d:674f:: with SMTP id w15mr17891965otm.243.1582074821264; Tue, 18 Feb 2020 17:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582074821; cv=none; d=google.com; s=arc-20160816; b=Vvtn3ew1Y5d8P83+0KiQsh48mP6iNHFRsvXiek4N4JZEEYqFzG1X90bWjzff0z7W6T dA9RsVWi65vDEXyhL94zt8KSinSwoHJbi7SXlT+nwuXmYihXHCa6zAWP3Y+dOGXRP5mH OnWatEiX6HlLML68qRFXiQ6AVI58f4KftW4npjZ8VjCOR6ECMvZJtQAUbBfyz+rDlXb2 7hxUPT1pg9fBLqYM/vNVXIow2XB9sJ3bymloTX/hGUO4z/0t45E+AkM/T5c+Ioxohkuz 3l3fhpj4Rnb8LXTyZ7wzLhR2PinlRTsBqTMpY/Hd9uXHV/ZcD8eyd4h96zUg3Lkkblrs pUKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=169bBczyyFHIG/Q8UwlECaKiABa8QJEvrDhzzb+cU00=; b=Tg7LpdxOO24zDcz6ywqqbW1FHtRowLXFCPOUpzvpUlMg91taYHsULeYJ+6cN/d+820 zWQVaCUsAxcrC+YaV2kMj6k2T0LksiHCOadU5qX9OgGSdxMfB9i3RP3BJpcF05azAcTH lNH6833AhJf11BWpkVnid+G7ar5hncwXZe/qv9xLBC9JnfR6PzThosnPOibNqFQqa8VS tg3uJ7yK3ThDidABvfqwD7UYT9MRJ7WVrQtzdwaYfD1xEK7FEfJmqwrce34QIitbYbsP WpyPXbCoNlvJDu6zl9NghtrbE46rtxT0+pagbgXL9w8/SjYz4EnL68ylI2AbHTWDe3LI fHSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=U8FaG0b0; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si280850otm.168.2020.02.18.17.13.24; Tue, 18 Feb 2020 17:13:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=U8FaG0b0; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbgBSBNK (ORCPT + 99 others); Tue, 18 Feb 2020 20:13:10 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:9710 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbgBSBNK (ORCPT ); Tue, 18 Feb 2020 20:13:10 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 18 Feb 2020 17:11:58 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 18 Feb 2020 17:13:09 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 18 Feb 2020 17:13:09 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 19 Feb 2020 01:13:09 +0000 Subject: Re: [PATCH v6 07/19] mm: Put readahead pages in cache earlier To: Matthew Wilcox CC: , , , , , , , , , References: <20200217184613.19668-1-willy@infradead.org> <20200217184613.19668-12-willy@infradead.org> <20200219010209.GI24185@bombadil.infradead.org> X-Nvconfidentiality: public From: John Hubbard Message-ID: <61bcaa87-91b2-857b-350a-86dab81a1f13@nvidia.com> Date: Tue, 18 Feb 2020 17:13:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200219010209.GI24185@bombadil.infradead.org> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1582074718; bh=169bBczyyFHIG/Q8UwlECaKiABa8QJEvrDhzzb+cU00=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=U8FaG0b00obFZSv859L8oWEaaOcwQeUfDVqSWQFkBUZBOwH8vbuoD4N7mPb4ZFtWF 66/vGL4h4APgHKYjB8OgTdyZD1sLYo/MuGcyMep47kybExxzp1I/HCoaNBtiZxm2fS z+CWh0MSAuooR6vk29dw1BMTJOJvxutR9mbmjwbxN3WnaOY/L50yURHxsLJObLpMQU Ye+mwSNNOhmkQv3gZWRZzP6kLA76Kaff/6vAmGV/UaA/UAx4frrOHDuI7u/Oh55/eT 2fQWmlP0+bY+bGivsDqexntMqk58H3NzVgP/QqVhoTlnPJM3AeBJTvYVT4g9z/6mYr 7MuMCGqKPcA/Q== Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2/18/20 5:02 PM, Matthew Wilcox wrote: > On Tue, Feb 18, 2020 at 04:01:43PM -0800, John Hubbard wrote: >> How about this instead? It uses the "for" loop fully and more naturally, >> and is easier to read. And it does the same thing: >> >> static inline struct page *readahead_page(struct readahead_control *rac) >> { >> struct page *page; >> >> if (!rac->_nr_pages) >> return NULL; >> >> page = xa_load(&rac->mapping->i_pages, rac->_start); >> VM_BUG_ON_PAGE(!PageLocked(page), page); >> rac->_batch_count = hpage_nr_pages(page); >> >> return page; >> } >> >> static inline struct page *readahead_next(struct readahead_control *rac) >> { >> rac->_nr_pages -= rac->_batch_count; >> rac->_start += rac->_batch_count; >> >> return readahead_page(rac); >> } >> >> #define readahead_for_each(rac, page) \ >> for (page = readahead_page(rac); page != NULL; \ >> page = readahead_page(rac)) > > I'm assuming you mean 'page = readahead_next(rac)' on that second line. Yep. :) > > If you keep reading all the way to the penultimate patch, it won't work > for iomap ... at least not in the same way. > OK, getting there... thanks, -- John Hubbard NVIDIA