Skip to content

Commit e575d40

Browse files
committed
mm/memcontrol: Replace the PREEMPT_RT conditionals
Use VM_WARN_ON_IRQS_ENABLED() and preempt_disable/enable_nested() to replace the CONFIG_PREEMPT_RT #ifdeffery. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Muchun Song <[email protected]> Acked-by: Johannes Weiner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Michal Hocko <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a738e9b commit e575d40

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

mm/memcontrol.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,25 +597,18 @@ static u64 flush_next_time;
597597
*/
598598
static void memcg_stats_lock(void)
599599
{
600-
#ifdef CONFIG_PREEMPT_RT
601-
preempt_disable();
602-
#else
603-
VM_BUG_ON(!irqs_disabled());
604-
#endif
600+
preempt_disable_nested();
601+
VM_WARN_ON_IRQS_ENABLED();
605602
}
606603

607604
static void __memcg_stats_lock(void)
608605
{
609-
#ifdef CONFIG_PREEMPT_RT
610-
preempt_disable();
611-
#endif
606+
preempt_disable_nested();
612607
}
613608

614609
static void memcg_stats_unlock(void)
615610
{
616-
#ifdef CONFIG_PREEMPT_RT
617-
preempt_enable();
618-
#endif
611+
preempt_enable_nested();
619612
}
620613

621614
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,
715708
* interrupt context while other caller need to have disabled interrupt.
716709
*/
717710
__memcg_stats_lock();
718-
if (IS_ENABLED(CONFIG_DEBUG_VM) && !IS_ENABLED(CONFIG_PREEMPT_RT)) {
711+
if (IS_ENABLED(CONFIG_DEBUG_VM)) {
719712
switch (idx) {
720713
case NR_ANON_MAPPED:
721714
case NR_FILE_MAPPED:
@@ -725,7 +718,7 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
725718
WARN_ON_ONCE(!in_task());
726719
break;
727720
default:
728-
WARN_ON_ONCE(!irqs_disabled());
721+
VM_WARN_ON_IRQS_ENABLED();
729722
}
730723
}
731724

0 commit comments

Comments
 (0)