Go to file
Yosry Ahmed 1a9570e74d mm: workingset: move the stats flush into workingset_test_recent()
Upstream: commit b006847222623ac3cda8589d15379eac86a2bcb7
Conflicts: none
Backport-reason: mm: memcg: subtree stats flushing and thresholds

The workingset code flushes the stats in workingset_refault() to get
accurate stats of the eviction memcg.  In preparation for more scoped
flushed and passing the eviction memcg to the flush call, move the call to
workingset_test_recent() where we have a pointer to the eviction memcg.

The flush call is sleepable, and cannot be made in an rcu read section.
Hence, minimize the rcu read section by also moving it into
workingset_test_recent().  Furthermore, instead of holding the rcu read
lock throughout workingset_test_recent(), only hold it briefly to get a
ref on the eviction memcg.  This allows us to make the flush call after we
get the eviction memcg.

As for workingset_refault(), nothing else there appears to be protected by
rcu.  The memcg of the faulted folio (which is not necessarily the same as
the eviction memcg) is protected by the folio lock, which is held from all
callsites.  Add a VM_BUG_ON() to make sure this doesn't change from under
us.

No functional change intended.

Link: https://lkml.kernel.org/r/20231129032154.3710765-5-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Tested-by: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: Ivan Babrou <ivan@cloudflare.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Michal Koutny <mkoutny@suse.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Tejun Heo <tj@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Wei Xu <weixugc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kairui Song <kasong@tencent.com>
2024-04-03 16:58:48 +08:00
Documentation docs/perf: Add ampere_cspmu to toctree to fix a build warning 2024-03-14 17:15:27 +08:00
LICENSES LICENSES: Add the copyleft-next-0.3.1 license 2022-11-08 15:44:01 +01:00
arch dist: config: update config 2024-04-03 16:58:47 +08:00
block Merge branch 'linux-6.6.y' 2024-03-04 10:25:33 +08:00
certs certs: Reference revocation list for all keyrings 2023-08-17 20:12:41 +00:00
crypto crypto: algif_hash - Remove bogus SGL free on zero-length error path 2024-02-23 09:25:11 +01:00
dist dist: disable non kernel pkg on non default config 2024-04-03 16:58:46 +08:00
drivers pci: bypass NVMe when booting PCIe storage with 5s delay 2024-03-15 21:56:47 +08:00
fs Merge branch 'linux-6.6.y' 2024-03-04 16:09:50 +08:00
include kabi: move reservation in mem_cgroup to tail 2024-04-03 16:58:47 +08:00
init Merge remote-tracking branch 'stable/linux-6.6.y' into ocks-2401 2024-03-01 17:21:23 +08:00
io_uring io_uring/net: fix multishot accept overflow handling 2024-02-23 09:25:10 +01:00
ipc Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
kernel bpf: Add ability to pin bpf timer to calling CPU 2024-03-27 18:09:14 +08:00
lib lib/Kconfig.debug: TEST_IOV_ITER depends on MMU 2024-03-01 13:34:59 +01:00
mm mm: workingset: move the stats flush into workingset_test_recent() 2024-04-03 16:58:48 +08:00
net eks: net/toa: add ali_cip support 2024-04-03 15:36:21 +08:00
rust rust: upgrade to Rust 1.73.0 2024-02-16 19:10:43 +01:00
samples work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:24:47 +01:00
scripts checkpatch: add Signed-off-by check if commit cherry-pick from upstream 2024-03-27 21:59:03 +08:00
security Merge remote-tracking branch 'stable/linux-6.6.y' into ocks-2401 2024-03-01 17:21:23 +08:00
sound Merge branch 'linux-6.6.y' 2024-03-04 10:25:33 +08:00
tools selftests/bpf: Test pinning bpf timer to a core 2024-03-27 18:09:18 +08:00
usr initramfs: Encode dependency on KBUILD_BUILD_TIMESTAMP 2023-06-06 17:54:49 +09:00
virt ARM: 2023-09-07 13:52:20 -07:00
.clang-format iommu: Add for_each_group_device() 2023-05-23 08:15:51 +02:00
.cocciconfig
.get_maintainer.ignore get_maintainer: add Alan to .get_maintainer.ignore 2022-08-20 15:17:44 -07:00
.gitattributes dist: initial support 2023-12-12 15:56:34 +08:00
.gitignore dist: initial support 2023-12-12 15:56:34 +08:00
.mailmap 20 hotfixes. 12 are cc:stable and the remainder address post-6.5 issues 2023-10-24 09:52:16 -10:00
.rustfmt.toml rust: add `.rustfmt.toml` 2022-09-28 09:02:20 +02:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS USB: Remove Wireless USB and UWB documentation 2023-08-09 14:17:32 +02:00
Kbuild Kbuild updates for v6.1 2022-10-10 12:00:45 -07:00
Kconfig tkernel: netatop: add netatop module in kernel/tkernel/ 2023-12-12 15:56:47 +08:00
MAINTAINERS MAINTAINERS: add Catherine as xfs maintainer for 6.6.y 2024-02-16 19:10:43 +01:00
Makefile kabi: provide kabi check/update/create commands for local users 2024-03-26 14:10:56 +08:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00
config-readme Makefile, dist: add "make tencentconfig" support 2024-03-04 13:25:26 +08:00

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.