Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2998298imm; Sun, 1 Jul 2018 10:01:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzs3n3s4tnrrz1Dm9+0x0kHofrKwPib3ppJWJSAxkGUTJIaoPKGpLU21yehZIG2Xe5WHVE X-Received: by 2002:a17:902:88:: with SMTP id a8-v6mr22265587pla.156.1530464462215; Sun, 01 Jul 2018 10:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530464462; cv=none; d=google.com; s=arc-20160816; b=sa5A1e8VE0nz8G8kBXR9DId9JErq+tmqCsc8D6DkRU0puvh/bUGdyJUALat8SoqpiT jyjpHelzxYtYmGZqXsS9p3d9HM+R8ExsFCZ+ezVqOo9dDW0K1Vj453F9vrjOos78PKEs 4BBvHdlteWkzWsIDfdKiEHZeabOJXGYYM4Sd6iEdPFopdJoUW4GZs9QWA8f9IJooOdSy rs13GkP9TkTo7ABGBtuqw5Q9h5y6cggihSZccB6Yk4LYR+ju7f2MWg6fchFD1T1FW++c n5xfHB6Rn9pwo6Fs0hR9h3tW+q/K3lw+Zx/pOdcEfQvLLV2ghXutstaaB+C8Kqey1l4i 2Jkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=5kIOolSZt2XXOJ6Of2c/IuUI2/f/5UKYE7oQt+LAmZQ=; b=ni9m6nAePJDLAGr69zRwf6N0qDE+Ox/ZXQEEKQlLR9sPO9TCyJoGLnHwSAMRh1kc2+ hvv/6h2xwbqZleRDT9+xunXLJWopvXc++BgUHHRXW4TNyoxQq+Lq/9owlYm9jRibAyG2 ibM7kmh0Yyt/31lZampb54ukGqptLQIXJZz+WMf+8eovF1KnDtLZmpXb9U8NeBcAK5ji 7ojWXiajJI9NKf5GOyFr3zCOaCIUQVUF9GmWkkxuHa9/THKElCZZEEKER11pvWuAfvTH NMMk76Kyb56tS/bhLVdAS9lU8XkPrhauMy4nknJ2H9VItlWQ3g70CMMweWw9R9r8zAD+ ptLQ== 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 t26-v6si12191327pgv.513.2018.07.01.10.00.47; Sun, 01 Jul 2018 10:01:02 -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 S1032426AbeGAQny (ORCPT + 99 others); Sun, 1 Jul 2018 12:43:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37914 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032052AbeGAQnt (ORCPT ); Sun, 1 Jul 2018 12:43:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9AD21AD8; Sun, 1 Jul 2018 16:43:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 4.17 159/220] f2fs: dont use GFP_ZERO for page caches Date: Sun, 1 Jul 2018 18:23:03 +0200 Message-Id: <20180701160914.924376126@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chao Yu commit 81114baa835b59ed02d14aa1d67f91ea874077cd upstream. Related to https://lkml.org/lkml/2018/4/8/661 Sometimes, we need to write meta data to new allocated block address, then we will allocate a zeroed page in inner inode's address space, and fill partial data in it, and leave other place with zero value which means some fields are initial status. There are two inner inodes (meta inode and node inode) setting __GFP_ZERO, I have just checked them, for both of them, we can avoid using __GFP_ZERO, and do initialization by ourselves to avoid unneeded/redundant zeroing from mm. Cc: Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/checkpoint.c | 4 +++- fs/f2fs/inode.c | 4 ++-- fs/f2fs/segment.c | 3 +++ fs/f2fs/segment.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -100,8 +100,10 @@ repeat: * readonly and make sure do not write checkpoint with non-uptodate * meta page. */ - if (unlikely(!PageUptodate(page))) + if (unlikely(!PageUptodate(page))) { + memset(page_address(page), 0, PAGE_SIZE); f2fs_stop_checkpoint(sbi, false); + } out: return page; } --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -320,10 +320,10 @@ struct inode *f2fs_iget(struct super_blo make_now: if (ino == F2FS_NODE_INO(sbi)) { inode->i_mapping->a_ops = &f2fs_node_aops; - mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_ZERO); + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); } else if (ino == F2FS_META_INO(sbi)) { inode->i_mapping->a_ops = &f2fs_meta_aops; - mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_ZERO); + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); } else if (S_ISREG(inode->i_mode)) { inode->i_op = &f2fs_file_inode_operations; inode->i_fop = &f2fs_file_operations; --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2020,6 +2020,7 @@ static void write_current_sum_page(struc struct f2fs_summary_block *dst; dst = (struct f2fs_summary_block *)page_address(page); + memset(dst, 0, PAGE_SIZE); mutex_lock(&curseg->curseg_mutex); @@ -3116,6 +3117,7 @@ static void write_compacted_summaries(st page = grab_meta_page(sbi, blkaddr++); kaddr = (unsigned char *)page_address(page); + memset(kaddr, 0, PAGE_SIZE); /* Step 1: write nat cache */ seg_i = CURSEG_I(sbi, CURSEG_HOT_DATA); @@ -3140,6 +3142,7 @@ static void write_compacted_summaries(st if (!page) { page = grab_meta_page(sbi, blkaddr++); kaddr = (unsigned char *)page_address(page); + memset(kaddr, 0, PAGE_SIZE); written_size = 0; } summary = (struct f2fs_summary *)(kaddr + written_size); --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -375,6 +375,7 @@ static inline void seg_info_to_sit_page( int i; raw_sit = (struct f2fs_sit_block *)page_address(page); + memset(raw_sit, 0, PAGE_SIZE); for (i = 0; i < end - start; i++) { rs = &raw_sit->entries[i]; se = get_seg_entry(sbi, start + i);