From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751859AbeACKsG (ORCPT + 1 other); Wed, 3 Jan 2018 05:48:06 -0500 Received: from outbound-smtp25.blacknight.com ([81.17.249.193]:51647 "EHLO outbound-smtp25.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751792AbeACKsC (ORCPT ); Wed, 3 Jan 2018 05:48:02 -0500 Date: Wed, 3 Jan 2018 10:48:00 +0000 From: Mel Gorman To: "??????(Caspar)" Cc: Andrew Morton , green@linuxhacker.ru, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "??????(??????)" , ?????? Subject: Re: [PATCH] mm/fadvise: discard partial pages iff endbyte is also eof Message-ID: <20180103104800.xgqe32hv63xsmsjh@techsingularity.net> References: <1514002568-120457-1-git-send-email-shidao.ytt@alibaba-inc.com> <8DAEE48B-AD5D-4702-AB4B-7102DD837071@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <8DAEE48B-AD5D-4702-AB4B-7102DD837071@alibaba-inc.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 that the system call get the exact size of the file correct and would not discard if the off + len was past the end of the file for whatever reason (e.g. a stat to read the size, a truncate in parallel and fadvise using stale data from stat) and that's why the patch looked like it might have no impact in practice. Is the patch known to help a real workload or is it motivated by a code inspection? -- Mel Gorman SUSE Labs