Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp745929ybv; Thu, 20 Feb 2020 06:36:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwSVTyKaKaOBuoMsC0gdN+YeinbynwGPFt3huji1L9Z9PMlar0mGialJhB1+CqwK404yAtS X-Received: by 2002:a05:6830:1d7b:: with SMTP id l27mr22384634oti.251.1582209406108; Thu, 20 Feb 2020 06:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582209406; cv=none; d=google.com; s=arc-20160816; b=iyb3U1PZtAGPNGTPYQp2Vr3PvJvmLDIWtJpr3KUIPy1i0wV7ssaRYBIjqr7oe75lMr G/jVA1E67S6u22TqFybOCWZsXSgf3tv5sxw4kLoQgrDD3eLigFXCBETVgh4F88BPutRn Lj+sN3CXxmRFs21mQYswzMmGoPnGqULhvmXAL0akfZVURgoLvX3ZFGnbykZAx6qgbLOL lwk21n/oaY+9/klWlcBPdpaQqyhHaHg2H9rIM2Z11EiAy1fCklc6FSMYDOm3fJP8dEjK TIpDy7fJWk/+K/HeDDaIqVMiqPcj2Qk/w6wtqJnHuBCYJ0+yZ8sh4GPvXuxYukSuEXDW MEEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=SnJgwePGNz1KwP9XyCGDsyTNIXJm80RakRuVGnRNh2k=; b=rHjx5eA7PDHYt2ISC7pfypo1ue+rzXUH3SNPMB7zg9kSEg+r/3xrT6pvr25kHv6HEI K4ch4DjPYXCJZNp+7FJyw79o0O2BIcSKLfjYEW61f9elU4/qFBA7gvMfPq9ZGGNQ1x// HaILN4r8MQSCrWRKpaxhqhlUpGPqutVr6LQWnC4+S7ycnWEALvWlhlbFSJK3oDbuv6Jz 3wfrhNSJtOMhOYnYSUQnfYl+eSDRCC1PjEIMJmzzVxeWAz7Mns/ZkKDRKENcURFKOVmF 4Y3cpDoetjdXurWUdGZf/5Ai9Xnb98VZZkusdT3PjZg4R0BhovlU7WfiSSuDqv2N32pu 28zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=FDT0nYs8; 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; 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 m24si1883579otf.101.2020.02.20.06.36.33; Thu, 20 Feb 2020 06:36:46 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=FDT0nYs8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728056AbgBTOgY (ORCPT + 99 others); Thu, 20 Feb 2020 09:36:24 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:2562 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbgBTOgX (ORCPT ); Thu, 20 Feb 2020 09:36:23 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 20 Feb 2020 06:35:50 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 20 Feb 2020 06:36:23 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 20 Feb 2020 06:36:23 -0800 Received: from [10.2.165.18] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 20 Feb 2020 14:36:22 +0000 From: Zi Yan To: Matthew Wilcox CC: , , , , , , , , , Subject: Re: [PATCH v7 04/24] mm: Move readahead nr_pages check into read_pages Date: Thu, 20 Feb 2020 09:36:19 -0500 X-Mailer: MailMate (1.13.1r5678) Message-ID: In-Reply-To: <20200219210103.32400-5-willy@infradead.org> References: <20200219210103.32400-1-willy@infradead.org> <20200219210103.32400-5-willy@infradead.org> MIME-Version: 1.0 X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: multipart/signed; boundary="=_MailMate_4CC2553B-18F9-4690-BE6D-05CCB84498AD_="; micalg=pgp-sha1; protocol="application/pgp-signature" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1582209350; bh=SnJgwePGNz1KwP9XyCGDsyTNIXJm80RakRuVGnRNh2k=; h=X-PGP-Universal:From:To:CC:Subject:Date:X-Mailer:Message-ID: In-Reply-To:References:MIME-Version:X-Originating-IP: X-ClientProxiedBy:Content-Type; b=FDT0nYs8cnBGBsD6LKu9r++ThtzZy580JjSbKP96scj+mumshmfRQ2FjF9WE2bWgG ZZd9Fkvay66NTmXX6GgKLwclVAHoCvF5uyeVrtd+8sdUsLUkbjdjbG8TvhaCarpiIx JlVLlpbLLJJjFXv6LO/jrVsBsRX6mKL01/zN9gcaxnklD5XBnv+o9jI5hIeKrWeIFv QY0c6t8P3/c4rXn9W5moLgbjwvi63enWEhSpHRtmkPjazAasGSOg2mg9+nm8O5ImLC OSi8yuXPNFPHWC7TOSxXEFi3U+IFL3YDIgGIX1mnREWvHTr/ZC/ZmoovE5FHlDuD+z N1sfrm/KY8NyA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=_MailMate_4CC2553B-18F9-4690-BE6D-05CCB84498AD_= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 19 Feb 2020, at 16:00, Matthew Wilcox wrote: > From: "Matthew Wilcox (Oracle)" > > Simplify the callers by moving the check for nr_pages and the BUG_ON > into read_pages(). > > Signed-off-by: Matthew Wilcox (Oracle) > --- > mm/readahead.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/mm/readahead.c b/mm/readahead.c > index 61b15b6b9e72..9fcd4e32b62d 100644 > --- a/mm/readahead.c > +++ b/mm/readahead.c > @@ -119,6 +119,9 @@ static void read_pages(struct address_space *mappin= g, struct file *filp, > struct blk_plug plug; > unsigned page_idx; > > + if (!nr_pages) > + return; > + > blk_start_plug(&plug); > > if (mapping->a_ops->readpages) { > @@ -138,6 +141,8 @@ static void read_pages(struct address_space *mappin= g, struct file *filp, > > out: > blk_finish_plug(&plug); > + > + BUG_ON(!list_empty(pages)); > } > > /* > @@ -180,8 +185,7 @@ void __do_page_cache_readahead(struct address_space= *mapping, > * contiguous pages before continuing with the next > * batch. > */ > - if (nr_pages) > - read_pages(mapping, filp, &page_pool, nr_pages, > + read_pages(mapping, filp, &page_pool, nr_pages, > gfp_mask); > nr_pages =3D 0; > continue; > @@ -202,9 +206,7 @@ void __do_page_cache_readahead(struct address_space= *mapping, > * uptodate then the caller will launch readpage again, and > * will then handle the error. > */ > - if (nr_pages) > - read_pages(mapping, filp, &page_pool, nr_pages, gfp_mask); > - BUG_ON(!list_empty(&page_pool)); > + read_pages(mapping, filp, &page_pool, nr_pages, gfp_mask); > } > > /* > -- = > 2.25.0 Looks good to me. Thanks. Reviewed-by: Zi Yan -- Best Regards, Yan Zi --=_MailMate_4CC2553B-18F9-4690-BE6D-05CCB84498AD_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBAgAtFiEEh7yFAW3gwjwQ4C9anbJR82th+ooFAl5OmWMPHHppeUBudmlk aWEuY29tAAoJEJ2yUfNrYfqKYawQAJnDCzvIOBkSaYYorEht2VZXHuWxGxkTwhkM TvpQUkB3Cff2onVNqU2DPF0usuD2Nr1qda6WHnPwGeTbxCokAwTsFkkn8JhJkqVf 2/xydKKHCGEdaL5n8d86v6J0kQx6Do1jBCqLOIx0rGVuCL0apnya4jKfrNO4OCAb T4pwf6/Qm2E2bBj3ISvybn/TYKq9WPpAu/ryMLNPidYqMqJiX4iqJ/RnBZ7srPcH TutPMCYvOJ4oUtbTzYq6AHiFfANTGKnBBeiH3v9QdJAla6/7FeiL9G6fEwMK0C3g FnzbqkYnPf+nR7a6Yg5ZejT33u9g7CP18xykij7jYUxPe7G1P2gVFflDIzkDie0+ LgYPICjmeYOKQxi2nrax2NpS+PqKq2mcGoZANosRwWvdlS0N/pUfOVZiCk2E8q7V UIi0c16u5lhuGpTCd2Y0rDxpItZ/eh912iqaxkjhKqlgxNdO1n78/2tiAXf/JqD9 xt1LEjKMkDUxiqvvCvJNXONKWSyATDPWlwXZSdjMi0jjsdusO+74WDheJm9Y0ylN o8+lS74JyYFdmRRMlyfPDeNDdIjLJf5FL1Ke+8vR85rwt0yBRY7CGj37O6LlCHMM eo4carZ4q5rC3EnAG0+Lf3uYaQXCbr0R1vvZkqnLJZfJuhFdMjI0l7fb/02PBG3L f+4j17Gl =Jsz+ -----END PGP SIGNATURE----- --=_MailMate_4CC2553B-18F9-4690-BE6D-05CCB84498AD_=--