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: <Y9O42N9J9gAsbJ6T@hyeyoo>
Date:   Fri, 27 Jan 2023 20:43:20 +0900
From:   Hyeonggon Yoo <42.hyeyoo@...il.com>
To:     Michal Hocko <mhocko@...e.com>
Cc:     Vlastimil Babka <vbabka@...e.cz>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Ingo Molnar <mingo@...hat.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Shakeel Butt <shakeelb@...gle.com>,
        Muchun Song <muchun.song@...ux.dev>,
        Matthew Wilcox <willy@...radead.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH mm-unstable] lib/Kconfig.debug: do not enable
 DEBUG_PREEMPT by default

On Wed, Jan 25, 2023 at 10:51:05AM +0100, Michal Hocko wrote:
> On Thu 26-01-23 00:41:15, Hyeonggon Yoo wrote:
> [...]
> > > Do you happen to have any perf data collected during those runs? I
> > > would be interested in the memcg side of things. Maybe we can do
> > > something better there.
> > 
> > Yes, below is performance data I've collected.
> > 
> > 6.1.8-debug-preempt-dirty
> > =========================
> >   Overhead  Command       Shared Object     Symbol
> > +    9.14%  hackbench        [kernel.vmlinux]  [k] check_preemption_disabled
> 
> Thanks! Could you just add callers that are showing in the profile for
> this call please?

-   14.56%     9.14%  hackbench        [kernel.vmlinux]  [k] check_preemption_disabled                          
   - 6.37% check_preemption_disabled                                                                            
      + 3.48% mod_objcg_state                                                                                   
      + 1.10% obj_cgroup_charge                                                                                 
        1.02% refill_obj_stock                                                                                  
     0.67% memcg_slab_post_alloc_hook                                                                           
     0.58% mod_objcg_state      

According to perf, many memcg functions call this function
and that's because __this_cpu_xxxx checks if preemption is disabled.

in include/linux/percpu-defs.h:

/*
 * Operations for contexts that are safe from preemption/interrupts.  These
 * operations verify that preemption is disabled.
 */
#define __this_cpu_read(pcp)                                            \
({                                                                      \
        __this_cpu_preempt_check("read");                               \
        raw_cpu_read(pcp);                                              \
})

#define __this_cpu_write(pcp, val)                                      \
({                                                                      \
        __this_cpu_preempt_check("write");                              \
        raw_cpu_write(pcp, val);                                        \
})

#define __this_cpu_add(pcp, val)                                        \
({                                                                      \
        __this_cpu_preempt_check("add");                                \
        raw_cpu_add(pcp, val);                                          \
})

in lib/smp_processor_id.c:

noinstr void __this_cpu_preempt_check(const char *op)
{
        check_preemption_disabled("__this_cpu_", op);
}
EXPORT_SYMBOL(__this_cpu_preempt_check);


> -- 
> Michal Hocko
> SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ