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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230331150430.546de954b0a7918f042c562e@linux-foundation.org>
Date:   Fri, 31 Mar 2023 15:04:30 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Qi Zheng <zhengqi.arch@...edance.com>
Cc:     willy@...radead.org, lstoakes@...il.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mm: swap: use folio_batch_reinit() in
 folio_batch_move_lru()

On Fri, 31 Mar 2023 17:58:57 +0800 Qi Zheng <zhengqi.arch@...edance.com> wrote:

> In folio_batch_move_lru(), the folio_batch is not freshly
> initialised, so it should call folio_batch_reinit() as
> pagevec_lru_move_fn() did before.
> 
> ...
>
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -222,7 +222,7 @@ static void folio_batch_move_lru(struct folio_batch *fbatch, move_fn_t move_fn)
>  	if (lruvec)
>  		unlock_page_lruvec_irqrestore(lruvec, flags);
>  	folios_put(fbatch->folios, folio_batch_count(fbatch));
> -	folio_batch_init(fbatch);
> +	folio_batch_reinit(fbatch);
>  }
>  
>  static void folio_batch_add_and_move(struct folio_batch *fbatch,

Well...  why?  This could leave the kernel falsely thinking that the
folio's pages have been drained from the per-cpu LRU addition
magazines.

Maybe that's desirable, maybe not, but I think this change needs much
much more explanation describing why it is beneficial.


folio_batch_reinit() seems to be a custom thing for the mlock code -
perhaps it just shouldn't exist, and its operation should instead be
open-coded in mlock_folio_batch().


The dynamics and rules around ->percpu_pvec_drained are a bit
mysterious.  A code comment which explains all of this would be
useful.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ