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] [day] [month] [year] [list]
Message-ID: <20200424131756.GB495720@cmpxchg.org>
Date:   Fri, 24 Apr 2020 09:17:56 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     Jaewon Kim <jaewon31.kim@...sung.com>
Cc:     Minchan Kim <minchan@...nel.org>, mgorman@...e.de,
        m.szyprowski@...sung.com, mina86@...a86.com, shli@...com,
        akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, jaewon31.kim@...il.com,
        ytk.lee@...sung.com
Subject: Re: [PATCH v2] mm/vmscan: count layzfree pages and fix nr_isolated_*
 mismatch

On Fri, Apr 24, 2020 at 01:16:45PM +0900, Jaewon Kim wrote:
> 
> 
> On 2020년 04월 24일 05:00, Minchan Kim wrote:
> > On Thu, Apr 23, 2020 at 12:05:46PM -0400, Johannes Weiner wrote:
> >> On Thu, Apr 23, 2020 at 12:16:02PM +0900, Jaewon Kim wrote:
> >>>
> >>> On 2020년 04월 22일 22:07, Johannes Weiner wrote:
> >>>> On Wed, Apr 22, 2020 at 05:48:15PM +0900, Jaewon Kim wrote:
> >>>>> @@ -1295,11 +1295,15 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> >>>>>  		 */
> >>>>>  		if (page_mapped(page)) {
> >>>>>  			enum ttu_flags flags = ttu_flags | TTU_BATCH_FLUSH;
> >>>>> +			bool lazyfree = PageAnon(page) && !PageSwapBacked(page);
> >>>>>  
> >>>>>  			if (unlikely(PageTransHuge(page)))
> >>>>>  				flags |= TTU_SPLIT_HUGE_PMD;
> >>>>> +
> >>>>>  			if (!try_to_unmap(page, flags)) {
> >>>>>  				stat->nr_unmap_fail += nr_pages;
> >>>>> +				if (lazyfree && PageSwapBacked(page))
> >>>> This looks pretty strange, until you remember that try_to_unmap()
> >>>> could SetPageSwapbacked again.
> >>>>
> >>>> This might be more obvious?
> >>>>
> >>>> 			was_swapbacked = PageSwapBacked(page);
> >>>> 			if (!try_to_unmap(page, flags)) {
> >>>> 				stat->nr_unmap_fail += nr_pages;
> >>>> 				if (!was_swapbacked && PageSwapBacked(page))
> >>> Hello Johannes, thank you for your comment.
> >>>
> >>> The name can changed from layzyfree to was_swapbacked.
> >>> By the way, did you mean removing PageAnon(page), too? It seems to be OK, though.
> >> I can't decide whether PageAnon() makes it clearer or not. But it's
> >> not really needed for correctness. So feel free to keep what you had.
> > Yub, PageAnon is redundant.
> >
> >> I would really just at least change bool lazyfree to was_lazyfree,
> > It's better.
> Thank you both.
> 
> Sorry but let me ask again.
> 
> Because PageAnon is redundant, let me remove it on checking lazyfree.
> Then, I think, was_swapbacked (first suggestion) is better then was_lazyfree (second suggestion),
> because it just checks PageSwapBacked(page). And we knows was_swapbacked is used for lazyfree on stat->nr_lazyfree_fail.
> 
> If you don't mind let me pick was_swapbacked instead of was_lazyfree

That sounds good to me. Thanks Jaewon!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ