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: <20220813162325.57bb5d703d0063d717dc47e9@linux-foundation.org>
Date:   Sat, 13 Aug 2022 16:23:25 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     cgel.zte@...il.com
Cc:     bsingharora@...il.com, iamjoonsoo.kim@....com, mingo@...hat.com,
        bristot@...hat.com, vschneid@...hat.com, willy@...radead.org,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-mm@...ck.org, Yang Yang <yang.yang29@....com.cn>,
        Ran Xiaokai <ran.xiaokai@....com.cn>,
        wangyong <wang.yong12@....com.cn>
Subject: Re: [PATCH 1/2] delayacct: support re-entrance detection of
 thrashing accounting

On Sat, 13 Aug 2022 07:41:09 +0000 cgel.zte@...il.com wrote:

> From: Yang Yang <yang.yang29@....com.cn>
> 
> Once upon a time, we only support accounting thrashing of page cache.
> Then Joonsoo introduced workingset detection for anonymous pages and
> we gained the ability to account thrashing of them[1].
> 
> For page cache thrashing accounting, there is no suitable place to do
> it in fs level likes swap_readpage(). So we have to do it in
> folio_wait_bit_common().
> 
> Then for anonymous pages thrashing accounting, we have to do it in
> both swap_readpage() and folio_wait_bit_common(). This likes PSI,
> so we should let thrashing accounting supports re-entrance detection.
> 
> This patch is to prepare complete thrashing accounting, and is based
> on patch "filemap: make the accounting of thrashing more consistent".
> 
> -static inline void delayacct_thrashing_start(void)
> +static inline void delayacct_thrashing_start(unsigned long *flags)

I don't think that `flags' is a very descriptive name.  It might be
anything.  

> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -943,6 +943,10 @@ struct task_struct {
>  #ifdef	CONFIG_CPU_SUP_INTEL
>  	unsigned			reported_split_lock:1;
>  #endif
> +#ifdef CONFIG_TASK_DELAY_ACCT
> +	/* delay due to memory thrashing */
> +	unsigned                        in_thrashing:1;
> +#endif

OK, saving space in the task_struct is good.

>  	unsigned long			atomic_flags; /* Flags requiring atomic access. */
>  
> diff --git a/kernel/delayacct.c b/kernel/delayacct.c
> index 164ed9ef77a3..a5916196022f 100644
> --- a/kernel/delayacct.c
> +++ b/kernel/delayacct.c
> @@ -214,13 +214,22 @@ void __delayacct_freepages_end(void)
>  		      &current->delays->freepages_count);
>  }
>  
> -void __delayacct_thrashing_start(void)
> +void __delayacct_thrashing_start(unsigned long *flags)
>  {
> +	*flags = current->in_thrashing;
> +	if (*flags)
> +		return;

Can't we rename `flags' to `in_thrashing' throughout?

And may as well give it type `bool'.  And convert that bool to/from the
bitfield when moving it in and out of the task_struct with

	*in_thrashing = !!current->in_thrashing;

	current->in_thrashing = (in_thrashing != 0);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ