]> git.baikalelectronics.ru Git - kernel.git/commit
net: avoid possible false sharing in sk_leave_memory_pressure()
authorEric Dumazet <edumazet@google.com>
Wed, 9 Oct 2019 19:55:53 +0000 (12:55 -0700)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 10 Oct 2019 04:30:22 +0000 (21:30 -0700)
commit830b91ad49437ba15bdb02ee0a778179bed9c2ed
treef50bafcd6d959fb284425e2ac830b8f73c5dbbb7
parent4296b0f7fba3dff1f222fe2877517aea55d6296c
net: avoid possible false sharing in sk_leave_memory_pressure()

As mentioned in https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
a C compiler can legally transform :

if (memory_pressure && *memory_pressure)
        *memory_pressure = 0;

to :

if (memory_pressure)
        *memory_pressure = 0;

Fixes: aa23fbd179ed ("tcp: add TCPMemoryPressuresChrono counter")
Fixes: 3a062d249a07 ("foundations of per-cgroup memory pressure controlling.")
Fixes: a78fd812dd9f ("[NET] CORE: Introducing new memory accounting interface.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
net/core/sock.c