Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: memcg: put struct task_struct::in_user_fault under CONFIG_MEMCG_V1

The struct task_struct's in_user_fault member is not used by the cgroup
v2's memory controller, so it can be put under the CONFIG_MEMCG_V1 config
option. To do so, mem_cgroup_enter_user_fault() and
mem_cgroup_exit_user_fault() are moved under the CONFIG_MEMCG_V1 option as
well.

Link: https://lkml.kernel.org/r/20240628210317.272856-10-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Roman Gushchin and committed by
Andrew Morton
1419ff98 1c3a0b3d

+21 -21
+20 -20
include/linux/memcontrol.h
··· 943 943 944 944 void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg); 945 945 946 - static inline void mem_cgroup_enter_user_fault(void) 947 - { 948 - WARN_ON(current->in_user_fault); 949 - current->in_user_fault = 1; 950 - } 951 - 952 - static inline void mem_cgroup_exit_user_fault(void) 953 - { 954 - WARN_ON(!current->in_user_fault); 955 - current->in_user_fault = 0; 956 - } 957 - 958 946 struct mem_cgroup *mem_cgroup_get_oom_group(struct task_struct *victim, 959 947 struct mem_cgroup *oom_domain); 960 948 void mem_cgroup_print_oom_group(struct mem_cgroup *memcg); ··· 1387 1399 } 1388 1400 1389 1401 static inline void mem_cgroup_handle_over_high(gfp_t gfp_mask) 1390 - { 1391 - } 1392 - 1393 - static inline void mem_cgroup_enter_user_fault(void) 1394 - { 1395 - } 1396 - 1397 - static inline void mem_cgroup_exit_user_fault(void) 1398 1402 { 1399 1403 } 1400 1404 ··· 1870 1890 rcu_read_unlock(); 1871 1891 } 1872 1892 1893 + static inline void mem_cgroup_enter_user_fault(void) 1894 + { 1895 + WARN_ON(current->in_user_fault); 1896 + current->in_user_fault = 1; 1897 + } 1898 + 1899 + static inline void mem_cgroup_exit_user_fault(void) 1900 + { 1901 + WARN_ON(!current->in_user_fault); 1902 + current->in_user_fault = 0; 1903 + } 1904 + 1873 1905 #else /* CONFIG_MEMCG_V1 */ 1874 1906 static inline 1875 1907 unsigned long memcg1_soft_limit_reclaim(pg_data_t *pgdat, int order, ··· 1919 1927 static inline bool mem_cgroup_oom_synchronize(bool wait) 1920 1928 { 1921 1929 return false; 1930 + } 1931 + 1932 + static inline void mem_cgroup_enter_user_fault(void) 1933 + { 1934 + } 1935 + 1936 + static inline void mem_cgroup_exit_user_fault(void) 1937 + { 1922 1938 } 1923 1939 1924 1940 #endif /* CONFIG_MEMCG_V1 */
+1 -1
include/linux/sched.h
··· 934 934 #ifndef TIF_RESTORE_SIGMASK 935 935 unsigned restore_sigmask:1; 936 936 #endif 937 - #ifdef CONFIG_MEMCG 937 + #ifdef CONFIG_MEMCG_V1 938 938 unsigned in_user_fault:1; 939 939 #endif 940 940 #ifdef CONFIG_LRU_GEN