From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752872AbeADLiS (ORCPT + 1 other); Thu, 4 Jan 2018 06:38:18 -0500 Received: from out0-235.mail.aliyun.com ([140.205.0.235]:54914 "EHLO out0-235.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752721AbeADLiR (ORCPT ); Thu, 4 Jan 2018 06:38:17 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01546;MF=jinli.zjl@alibaba-inc.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.A3BKG36_1515065888; Subject: Re: [PATCH] mm/fadvise: discard partial pages iff endbyte is also eof To: Mel Gorman Cc: "Andrew Morton" , , , , "=?UTF-8?B?5p2o5YuHKOaZuuW9uyk=?=" , "=?UTF-8?B?5Y2B5YiA?=" References: <1514002568-120457-1-git-send-email-shidao.ytt@alibaba-inc.com> <8DAEE48B-AD5D-4702-AB4B-7102DD837071@alibaba-inc.com> <20180103104800.xgqe32hv63xsmsjh@techsingularity.net> <7dd95219-f0be-b30a-0a43-2aadcc61899c@alibaba-inc.com> <20180104113451.j7dwal6mxbelt4p4@techsingularity.net> From: "=?UTF-8?B?5aS35YiZKENhc3Bhcik=?=" Message-ID: <95536212-b626-2a3a-dfe4-87e3f9fc2f22@alibaba-inc.com> Date: Thu, 04 Jan 2018 19:38:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180104113451.j7dwal6mxbelt4p4@techsingularity.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 2018/1/4 19:34, Mel Gorman wrote: > On Thu, Jan 04, 2018 at 02:13:43PM +0800, ??????(Caspar) wrote: >> >> >> On 2018/1/3 18:48, Mel Gorman wrote: >>> On Wed, Jan 03, 2018 at 02:53:43PM +0800, ??????(Caspar) wrote: >>>> >>>> >>>>> ?? 2017??12??23????12:16?????? ?????? >>>>> >>>>> From: "shidao.ytt" >>>>> >>>>> in commit 441c228f817f7 ("mm: fadvise: document the >>>>> fadvise(FADV_DONTNEED) behaviour for partial pages") Mel Gorman >>>>> explained why partial pages should be preserved instead of discarded >>>>> when using fadvise(FADV_DONTNEED), however the actual codes to calcuate >>>>> end_index was unexpectedly wrong, the code behavior didn't match to the >>>>> statement in comments; Luckily in another commit 18aba41cbf >>>>> ("mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED") >>>>> Oleg Drokin fixed this behavior >>>>> >>>>> Here I come up with a new idea that actually we can still discard the >>>>> last parital page iff the page-unaligned endbyte is also the end of >>>>> file, since no one else will use the rest of the page and it should be >>>>> safe enough to discard. >>>> >>>> +akpm... >>>> >>>> Hi Mel, Andrew: >>>> >>>> Would you please take a look at this patch, to see if this proposal >>>> is reasonable enough, thanks in advance! >>>> >>> >>> I'm backlogged after being out for the Christmas. Superficially the patch >>> looks ok but I wondered how often it happened in practice as we already >>> would discard files smaller than a page on DONTNEED. It also requires >> >> Actually, we would *not*. Let's look into the codes. >> > > You're right of course. I suggest updating the changelog with what you > found and the test case. I think it's reasonable to special case the > discarding of partial pages if it's the end of a file with the potential > addendum of checking if the endbyte is past the end of the file. The man > page should also be updated. Sure, will do and send out v2. Thanks, Caspar >