From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Yu Subject: [PATCH 2/4] f2fs: warm up cold page after mmaped write Date: Mon, 13 Jul 2015 17:43:19 +0800 Message-ID: <007f01d0bd50$720a37d0$561ea770$@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZEaHS-0007hr-HC for linux-f2fs-devel@lists.sourceforge.net; Mon, 13 Jul 2015 09:44:10 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1ZEaHQ-0005ul-LY for linux-f2fs-devel@lists.sourceforge.net; Mon, 13 Jul 2015 09:44:10 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NRF032OJ71DIC10@mailout2.samsung.com> for linux-f2fs-devel@lists.sourceforge.net; Mon, 13 Jul 2015 18:44:01 +0900 (KST) Content-language: zh-cn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net With cost-benifit method, background gc will consider old section with fewer valid blocks as candidate victim, these old blocks in section will be treated as cold data, and laterly will be moved into cold segment. But if the gcing page is attached by user through buffered or mmaped write, we should reset the page as non-cold one, because this page may have more opportunity for further updating. So fix to add clearing code for the missed 'mmap' case. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 55e8e4b..f69bcd6 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -86,6 +86,8 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, mapped: /* fill the page */ f2fs_wait_on_page_writeback(page, DATA); + /* if gced page is attached, don't write to cold segment */ + clear_cold_data(page); out: sb_end_pagefault(inode->i_sb); return block_page_mkwrite_return(err); -- 2.4.2 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752318AbbGMJoF (ORCPT ); Mon, 13 Jul 2015 05:44:05 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:51353 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752229AbbGMJoD (ORCPT ); Mon, 13 Jul 2015 05:44:03 -0400 X-AuditID: cbfee61b-f79416d0000014c0-73-55a3886145f3 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] f2fs: warm up cold page after mmaped write Date: Mon, 13 Jul 2015 17:43:19 +0800 Message-id: <007f01d0bd50$720a37d0$561ea770$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdC9UDkGCAO1P4lkRqW4pp6kyEKfWQ== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRmVeSWpSXmKPExsVy+t9jQd3EjsWhBq+7eC2erJ/FbHFpkbvF 5V1z2ByYPTat6mTz2L3gM5PH501yAcxRXDYpqTmZZalF+nYJXBlvf2xiKZjCUbHu4n/WBsYr bF2MnBwSAiYSqw92MUHYYhIX7q0HiwsJTGeUOLAru4uRC8h+xSixuesXWIJNQEViecd/sAYR IPvQosvsIDazgIdEY8d3VhBbWMBe4ub93WBxFgFViW+b3jCD2LwClhLLvz6EsgUlfky+xwLR qyWxfudxJghbXmLzmrfMEAcpSOw4+5oRYpeexMa9D6F2iUtsPHKLZQKjwCwko2YhGTULyahZ SFoWMLKsYhRNLUguKE5KzzXSK07MLS7NS9dLzs/dxAgO32fSOxhXNVgcYhTgYFTi4W3YsihU iDWxrLgy9xCjBAezkghvTvHiUCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8J/N9QoUE0hNLUrNT UwtSi2CyTBycUg2Mxufy/sanbLii7WXKvNv4h+7KR5MZfS2C09mfVf+9dIbjtfPydFHd3WUP OiWdGtP5SxiM6xe4Heydcu9dOduZp2wCB/Y+ql/0n/ukplJv8EHfBxp2PBtVuk78coh+FszF 3SjJ0xrB71me2MPRcYl/Ynm60eMZx4/4S19V0N21NYPzTeZmhnolluKMREMt5qLiRABBdB/d WwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With cost-benifit method, background gc will consider old section with fewer valid blocks as candidate victim, these old blocks in section will be treated as cold data, and laterly will be moved into cold segment. But if the gcing page is attached by user through buffered or mmaped write, we should reset the page as non-cold one, because this page may have more opportunity for further updating. So fix to add clearing code for the missed 'mmap' case. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 55e8e4b..f69bcd6 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -86,6 +86,8 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, mapped: /* fill the page */ f2fs_wait_on_page_writeback(page, DATA); + /* if gced page is attached, don't write to cold segment */ + clear_cold_data(page); out: sb_end_pagefault(inode->i_sb); return block_page_mkwrite_return(err); -- 2.4.2