lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8DAEE48B-AD5D-4702-AB4B-7102DD837071@alibaba-inc.com>
Date:   Wed, 03 Jan 2018 14:53:43 +0800
From:   "夷则(Caspar)" <jinli.zjl@...baba-inc.com>
To:     mgorman@...hsingularity.net,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     <green@...uxhacker.ru>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>,
        "杨勇(智彻)" <zhiche.yy@...baba-inc.com>,
        "十刀" <shidao.ytt@...baba-inc.com>
Subject: Re: [PATCH] mm/fadvise: discard partial pages iff endbyte is also eof



> 在 2017年12月23日,12:16,十刀 <shidao.ytt@...baba-inc.com> 写道:
> 
> From: "shidao.ytt" <shidao.ytt@...baba-inc.com>
> 
> 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!

Thanks,
Caspar

> 
> Signed-off-by: shidao.ytt <shidao.ytt@...baba-inc.com>
> Signed-off-by: Caspar Zhang <jinli.zjl@...baba-inc.com>
> ---
> mm/fadvise.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/fadvise.c b/mm/fadvise.c
> index ec70d6e..f74b21e 100644
> --- a/mm/fadvise.c
> +++ b/mm/fadvise.c
> @@ -127,7 +127,8 @@
> 		 */
> 		start_index = (offset+(PAGE_SIZE-1)) >> PAGE_SHIFT;
> 		end_index = (endbyte >> PAGE_SHIFT);
> -		if ((endbyte & ~PAGE_MASK) != ~PAGE_MASK) {
> +		if ((endbyte & ~PAGE_MASK) != ~PAGE_MASK &&
> +				endbyte != inode->i_size - 1) {
> 			/* First page is tricky as 0 - 1 = -1, but pgoff_t
> 			 * is unsigned, so the end_index >= start_index
> 			 * check below would be true and we'll discard the whole
> -- 
> 1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ