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: <YxDFplJXPudU4AS7@dhcp22.suse.cz>
Date:   Thu, 1 Sep 2022 16:45:58 +0200
From:   Michal Hocko <mhocko@...e.com>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Matthew Wilcox <willy@...radead.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Shakeel Butt <shakeelb@...gle.com>,
        Muchun Song <songmuchun@...edance.com>,
        cgroups@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v2 5/8] mm/memcontrol: Replace the PREEMPT_RT conditionals

On Thu 25-08-22 18:41:28, Sebastian Andrzej Siewior wrote:
> From: Thomas Gleixner <tglx@...utronix.de>
> 
> Use VM_WARN_ON_IRQS_ENABLED() and preempt_disable/enable_nested() to
> replace the CONFIG_PREEMPT_RT #ifdeffery.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Michal Hocko <mhocko@...nel.org>
> Cc: Roman Gushchin <roman.gushchin@...ux.dev>
> Cc: Shakeel Butt <shakeelb@...gle.com>
> Cc: Muchun Song <songmuchun@...edance.com>
> Cc: cgroups@...r.kernel.org
> Cc: linux-mm@...ck.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Acked-by: Johannes Weiner <hannes@...xchg.org>
> Reviewed-by: Muchun Song <songmuchun@...edance.com>
> Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>

Acked-by: Michal Hocko <mhocko@...e.com>
Thanks!

> ---
>  mm/memcontrol.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index b69979c9ced5c..d35b6fa560f0a 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -597,25 +597,18 @@ static u64 flush_next_time;
>   */
>  static void memcg_stats_lock(void)
>  {
> -#ifdef CONFIG_PREEMPT_RT
> -      preempt_disable();
> -#else
> -      VM_BUG_ON(!irqs_disabled());
> -#endif
> +	preempt_disable_nested();
> +	VM_WARN_ON_IRQS_ENABLED();
>  }
>  
>  static void __memcg_stats_lock(void)
>  {
> -#ifdef CONFIG_PREEMPT_RT
> -      preempt_disable();
> -#endif
> +	preempt_disable_nested();
>  }
>  
>  static void memcg_stats_unlock(void)
>  {
> -#ifdef CONFIG_PREEMPT_RT
> -      preempt_enable();
> -#endif
> +	preempt_enable_nested();
>  }
>  
>  static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val)
> @@ -715,7 +708,7 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
>  	 * interrupt context while other caller need to have disabled interrupt.
>  	 */
>  	__memcg_stats_lock();
> -	if (IS_ENABLED(CONFIG_DEBUG_VM) && !IS_ENABLED(CONFIG_PREEMPT_RT)) {
> +	if (IS_ENABLED(CONFIG_DEBUG_VM)) {
>  		switch (idx) {
>  		case NR_ANON_MAPPED:
>  		case NR_FILE_MAPPED:
> @@ -725,7 +718,7 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
>  			WARN_ON_ONCE(!in_task());
>  			break;
>  		default:
> -			WARN_ON_ONCE(!irqs_disabled());
> +			VM_WARN_ON_IRQS_ENABLED();
>  		}
>  	}
>  
> -- 
> 2.37.2

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ