Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp475006yba; Sun, 31 Mar 2019 04:35:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpXxTv2I+1ItppeYS4mMe1MVbEswwxxtT7w3dp3x7yYZFbTFeIohXNi1qvuQDJkgaRKBTX X-Received: by 2002:a17:902:e101:: with SMTP id cc1mr18747026plb.129.1554032123284; Sun, 31 Mar 2019 04:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554032123; cv=none; d=google.com; s=arc-20160816; b=0MnuaLQc0QepLVnLQEXR3DggzowpzSzzQ83AUC4pT7Dzd+A7kVjwcwepBbBh1d3lGe DwMBdNcKsXGCbJlTg5egC1rvKQigJFoSE4az6FYEOk5S/oB57+osJ1Iktrtlj6K/KhLr NO1iB2uIeli5afdg2sOaGT4cXngTGMOiE9Kis3xZ0lMdiT2I5Pzaltubv8CMVm7xar7L EA+WPY5rPFECg1THgLj3INKRogX2FMZk8R3/BVP+/EZ9IlXS7MJIGHsxtIbQTrX9F9n3 PAEQWxga9dl2ZQU1GwMsc7Fehmg5KpujLSRXbivBQs9srZ0oh7rMN8J5h8Rc4obxkhpN edSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=1KKM95aSddRYCwlGAbXOXhLBnXC60+nxLf+8Rblk33k=; b=Rid9vV9C2K1fRUhfTmdeIrSX518xMhAAR7pQIHZNzoEPZ4BcUvg/At8Nz+EF9IqJj1 BkuFd7HZbdy1qV8dCrNWWZnqwphux0O2LzxnPb/Pk6z8vm5XbBtO6lo2xmjL9BDxV+OI L2IJyGK2SxrzIV7uNy21I1fJi1oRpL9SmzyXExOGXdfTZizfikOtjFgqMZoVV4eqd4R7 aPMkt4NZnQZf+VcsjWfd9PpdDK37VUpfQnhcX7tiobOSPrRjBZepGreXOXoPMfAbvVcc KRxOE5wmiilLHKOYMDSon0anuJL5v744/xP8ZdmsxL0X9619Dzu8hQRaplkocGNdBR2n a4qg== 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 q4si6552637pfb.264.2019.03.31.04.34.54; Sun, 31 Mar 2019 04:35:23 -0700 (PDT) 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 S1731120AbfCaLd5 (ORCPT + 99 others); Sun, 31 Mar 2019 07:33:57 -0400 Received: from smtprz15.163.net ([106.3.154.248]:58270 "EHLO smtp.tom.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726960AbfCaLd5 (ORCPT ); Sun, 31 Mar 2019 07:33:57 -0400 Received: from 172.25.16.147 (unknown [172.25.16.147]) by freemail02.tom.com (Postfix) with ESMTP id D574DB0153C for ; Sun, 31 Mar 2019 16:11:46 +0800 (CST) Received: from 172.25.16.91 (HELO smtp.tom.com) ([172.25.16.91]) by localhost (TOM SMTP Server) with SMTP ID 1404414316 for ; Sun, 31 Mar 2019 16:11:46 +0800 (CST) Received: from antispam2.tom.com (unknown [172.25.16.56]) by freemail02.tom.com (Postfix) with ESMTP id 58D28B014F9 for ; Sun, 31 Mar 2019 16:11:46 +0800 (CST) Received: from antispam2.tom.com (antispam2.tom.com [127.0.0.1]) by antispam2.tom.com (Postfix) with ESMTP id 4F14381779 for ; Sun, 31 Mar 2019 16:11:46 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam2.tom.com Received: from antispam2.tom.com ([127.0.0.1]) by antispam2.tom.com (antispam2.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KCqXnDS3Oucw for ; Sun, 31 Mar 2019 16:11:45 +0800 (CST) Received: from localhost (unknown [222.209.17.169]) by antispam2.tom.com (Postfix) with ESMTPA id 084CA81518; Sun, 31 Mar 2019 16:11:44 +0800 (CST) From: Liu Xiang To: linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, liuxiang_1999@126.com, Liu Xiang Subject: [PATCH v2] ext4: fix prefetchw of NULL page Date: Sun, 31 Mar 2019 16:11:34 +0800 Message-Id: <1554019894-11041-1-git-send-email-liu.xiang6@zte.com.cn> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In ext4_mpage_readpages(), if the parameter pages is not NULL, another parameter page is NULL. At the first time prefetchw(&page->flags) works on NULL. From second time, prefetchw(&page->flags) always works on the last consumed page. This might do little improvment for handling current page. So prefetchw() should be called while the page pointer has just been updated. Signed-off-by: Liu Xiang --- Changes in v2: remove prefetchw() when pages is NULL and change comment fs/ext4/readpage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 6aa282e..f138c47 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -126,9 +126,10 @@ int ext4_mpage_readpages(struct address_space *mapping, int fully_mapped = 1; unsigned first_hole = blocks_per_page; - prefetchw(&page->flags); if (pages) { page = lru_to_page(pages); + + prefetchw(&page->flags); list_del(&page->lru); if (add_to_page_cache_lru(page, mapping, page->index, readahead_gfp_mask(mapping))) -- 1.9.1