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] [day] [month] [year] [list]
Date:	Tue, 24 Sep 2013 09:43:52 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Christoph Lameter <cl@...ux.com>
Cc:	Tejun Heo <tj@...nel.org>, akpm@...uxfoundation.org,
	Steven Rostedt <srostedt@...hat.com>,
	linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>
Subject: Re: [pchecks v1 3/4] Use raw_cpu_ops for refresh_cpu_vm_stats()


* Christoph Lameter <cl@...ux.com> wrote:

> We do not care about races for the expiration logic in
> refresh_cpu_vm_stats(). Draining is a rare act after all.
> No need to create too much overhead for that.
> 
> Use raw_cpu_ops there.
> 
> Signed-off-by: Christoph Lameter <cl@...ux.com>
> 
> Index: linux/mm/vmstat.c
> ===================================================================
> --- linux.orig/mm/vmstat.c	2013-09-23 10:20:31.742262228 -0500
> +++ linux/mm/vmstat.c	2013-09-23 10:20:31.738262268 -0500
> @@ -439,6 +439,10 @@ static inline void fold_diff(int *diff)
>   * statistics in the remote zone struct as well as the global cachelines
>   * with the global counters. These could cause remote node cache line
>   * bouncing and will have to be only done when necessary.
> + *
> + * Note that we have to use raw_cpu ops here. The thread is pinned
> + * to a specific processor but the preempt checking logic does not
> + * know about this.

That's not actually true - debug_smp_processor_id() does a check for the 
pinning status of the current task:

        /*
         * Kernel threads bound to a single CPU can safely use
         * smp_processor_id():
         */
        if (cpumask_equal(tsk_cpus_allowed(current), cpumask_of(this_cpu)))
                goto out;

You should factor out those existing debug checks and reuse them, instead 
of using inferior ones.

Note that debug_smp_processor_id() can probably be optimized a bit: today 
we have p->nr_cpus_allowed which tracks the pinning status, so instead of 
the above line we could write this cheaper form:

	if (current->nr_cpus_allowed == 1)
		goto out;

(This should help on kernels configured for larger systems where the 
cpumask is non-trivial.)

What we cannot do is to hide the weakness of the debug check you added by 
adding various workarounds to core code.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ