Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1513494pxk; Fri, 4 Sep 2020 11:14:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2xphU7RgHBIuwFudHcmBc3n9kj0hQQH7QwK70DjdJjL6B4OfcVCf1DV2R/0cg7m53SFul X-Received: by 2002:a05:6402:1859:: with SMTP id v25mr974817edy.118.1599243273462; Fri, 04 Sep 2020 11:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599243273; cv=none; d=google.com; s=arc-20160816; b=j38ZwafiWb8EhkJHnR1XeoXcPnmpZ6f5wIjYmqMJOJdfn89VV5reCIlpxv1ElEl48c VGRPqjRtEoyF+ahmZD+gRvHLv5S+blAasrB93edQGeg9aKllczWwSPo0IqCP3zFqriuK n1Ze+9pW7h9UN6lVDhSorJPwx5vPRhGEo/aH5wkt7Uuw9HukfYdV3oOlKjldEAkLwJkA E6rW37hnIbl6r4dqTGiLeJBXB72mZVkxKQACzeYj9rp+dOCJBm+i9U9Ij0+HclwWY99q 4wNJyKBjKC6ucBjW+gtIAnnNdS1P5OidLls7Xhk+Aajuof4z7mvIHQnY0hrkKkr+y3lA Gz0w== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NY3LniC7bohhwnkn4uhUvyrPCCWpKyNa/vo+2Cbxdfg=; b=fDqyPkBsv77X28rZjwq+z00oLSIR/Hm/qytWKpjiJ+v07SorKaYrMMScdzm0R8jvEX nhU/CkalkEZMQEBnEgaO5wJNtv+AxXlneWW5OVQpdFXY3KjCkcm0UEv1slTMkZGd+n9b iJcK6zfsCI+Uwsj3gFyfQljWDPvKUQDV7cTfgF9cPcJSuvDC+8d4I4gz5bhpZQNWux+L Z74urCVEcXLtlNn8DttwrWRyEbe5UD8JztlO19QeovOncF+nVytTHbZeSOv4zfrND+sT fQ9DfEeaKR0vq5QPgvOyTE6QSMEOHhdcRaxUw9+vBvzUGIof+QiFHrqOXn08dnXvEwAt clFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NZP8LJ1O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb15si4577480ejb.366.2020.09.04.11.14.09; Fri, 04 Sep 2020 11:14:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NZP8LJ1O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726938AbgIDSJl (ORCPT + 99 others); Fri, 4 Sep 2020 14:09:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:45472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbgIDSJk (ORCPT ); Fri, 4 Sep 2020 14:09:40 -0400 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF3D12074A; Fri, 4 Sep 2020 18:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599242980; bh=N8LVGiLGeSISjLSKzJzoAVbjyLXQ1OkgiG0m6g34uxE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NZP8LJ1O2HOiR53LSId8DQCa3O5d4LfVHPeAWWirXzQ2FJxZbYWjkULFLShHkaWEd sXoXjjTMeK9UqVWDRUNv1XVc20QtWDsq/akjiTk59zZks7AdssQFCHYaUDDBT7BZQQ Wcj3bE7beghhYl5ay+Qe28wEJFB4x+81SrX7s1vU= Date: Fri, 4 Sep 2020 11:09:38 -0700 From: Andrew Morton To: Bean Huo Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, beanhuo@micron.com Subject: Re: [PATCH RFC] mm: Let readahead submit larger batches of pages in case of ra->ra_pages == 0 Message-Id: <20200904110938.d9a2cb53a58e67a15c960f47@linux-foundation.org> In-Reply-To: <20200904144807.31810-1-huobean@gmail.com> References: <20200904144807.31810-1-huobean@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 4 Sep 2020 16:48:07 +0200 Bean Huo wrote: > From: Bean Huo > > Current generic_file_buffered_read() will break up the larger batches of pages > and read data in single page length in case of ra->ra_pages == 0. This patch is > to allow it to pass the batches of pages down to the device if the supported > maximum IO size >= the requested size. > > ... > > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2062,6 +2062,7 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb, > struct file *filp = iocb->ki_filp; > struct address_space *mapping = filp->f_mapping; > struct inode *inode = mapping->host; > + struct backing_dev_info *bdi = inode_to_bdi(mapping->host); > struct file_ra_state *ra = &filp->f_ra; > loff_t *ppos = &iocb->ki_pos; > pgoff_t index; > @@ -2098,9 +2099,14 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb, > if (!page) { > if (iocb->ki_flags & IOCB_NOIO) > goto would_block; > - page_cache_sync_readahead(mapping, > - ra, filp, > - index, last_index - index); > + > + if (!ra->ra_pages && bdi->io_pages >= last_index - index) > + __do_page_cache_readahead(mapping, filp, index, > + last_index - index, 0); > + else > + page_cache_sync_readahead(mapping, ra, filp, > + index, > + last_index - index); > page = find_get_page(mapping, index); > if (unlikely(page == NULL)) > goto no_cached_page; I assume this is a performance patch. What are the observed changes in behaviour? What is special about ->ra_pages==0? Wouldn't this optimization still be valid if ->ra_pages==2? Doesn't this defeat the purpose of having ->ra_pages==0?