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: <e9673684-ef3-4070-18bd-2f20fbfe8d5@gentwo.de>
Date:   Tue, 10 Jan 2023 12:58:32 +0100 (CET)
From:   Christoph Lameter <cl@...two.de>
To:     Marcelo Tosatti <mtosatti@...hat.com>
cc:     atomlin@...mlin.com, frederic@...nel.org, tglx@...utronix.de,
        mingo@...nel.org, peterz@...radead.org, pauld@...hat.com,
        neelx@...hat.com, oleksandr@...alenko.name,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v13 1/6] mm/vmstat: Add CPU-specific variable to track
 a vmstat discrepancy

On Thu, 5 Jan 2023, Marcelo Tosatti wrote:

> +static inline void vmstat_mark_dirty(void)
> +{
> +	this_cpu_write(vmstat_dirty, true);
> +}

this_cpu_write() is intended for an per cpu atomic context. You are not
using it in that way. The processor may have changed before or after and
thus vmstat_dirty for another CPU may  have been marked dirty.

I guess this would have to be called __vmstat_mark_dirty() and be using
__this_cpu_write(*) with a requirement that preemption be disabled before
using this function.

> +static inline void vmstat_clear_dirty(void)
> +{
> +	this_cpu_write(vmstat_dirty, false);
> +}

Same

> +static inline bool is_vmstat_dirty(void)
> +{
> +	return this_cpu_read(vmstat_dirty);
> +}

This function would only work correctly if preemption is disabled.
Otherwise the processor may change.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ