* [PATCH] mm/vmscan.c: drop_slab_node with task's memcg
@ 2021-04-02 10:38 Neil Sun
2021-04-02 14:38 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Neil Sun @ 2021-04-02 10:38 UTC (permalink / raw)
To: akpm, linux-mm, linux-kernel; +Cc: Neil Sun
This patch makes shrink_slab() with task's memcg in drop_slab_node(),
so we can free reclaimable slab objects belongs to memcg /lxc/i-vbe1u8o7
with following command:
cgexec -g memory:/lxc/i-vbe1u8o7 sysctl vm.drop_caches=2
Test with following steps:
root@i-yl0pwrt8:~# free -h
total used free shared buff/cache available
Mem: 62Gi 265Mi 62Gi 1.0Mi 290Mi 61Gi
Swap: 31Gi 0B 31Gi
root@i-yl0pwrt8:~# (cd /tmp && /root/generate_slab_cache)
root@i-yl0pwrt8:~# free -h
total used free shared buff/cache available
Mem: 62Gi 266Mi 60Gi 1.0Mi 2.2Gi 61Gi
Swap: 31Gi 0B 31Gi
root@i-yl0pwrt8:~# cgcreate -g memory:/lxc/i-vbe1u8o7
root@i-yl0pwrt8:~# cgexec -g memory:/lxc/i-vbe1u8o7 /root/generate_slab_cache
root@i-yl0pwrt8:~# free -h
total used free shared buff/cache available
Mem: 62Gi 267Mi 58Gi 1.0Mi 4.1Gi 61Gi
Swap: 31Gi 0B 31Gi
root@i-yl0pwrt8:~# cgexec -g memory:/lxc/i-vbe1u8o7 sysctl vm.drop_caches=2
vm.drop_caches = 2
root@i-yl0pwrt8:~# free -h
total used free shared buff/cache available
Mem: 62Gi 268Mi 60Gi 1.0Mi 2.2Gi 61Gi
Swap: 31Gi 0B 31Gi
root@i-yl0pwrt8:~# sysctl vm.drop_caches=2
vm.drop_caches = 2
root@i-yl0pwrt8:~# free -h
total used free shared buff/cache available
Mem: 62Gi 267Mi 62Gi 1.0Mi 290Mi 61Gi
Swap: 31Gi 0B 31Gi
Signed-off-by: Neil Sun <neilsun@yunify.com>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 562e87cb..81d770a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -702,7 +702,7 @@ void drop_slab_node(int nid)
return;
freed = 0;
- memcg = mem_cgroup_iter(NULL, NULL, NULL);
+ memcg = mem_cgroup_from_task(current);
do {
freed += shrink_slab(GFP_KERNEL, nid, memcg, 0);
} while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mm/vmscan.c: drop_slab_node with task's memcg
2021-04-02 10:38 [PATCH] mm/vmscan.c: drop_slab_node with task's memcg Neil Sun
@ 2021-04-02 14:38 ` kernel test robot
2021-04-02 14:50 ` kernel test robot
2021-04-06 7:21 ` Michal Hocko
2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-04-02 14:38 UTC (permalink / raw)
To: Neil Sun, akpm, linux-mm, linux-kernel
Cc: kbuild-all, clang-built-linux, Neil Sun
[-- Attachment #1: Type: text/plain, Size: 2764 bytes --]
Hi Neil,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v5.12-rc5]
[also build test ERROR on next-20210401]
[cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Neil-Sun/mm-vmscan-c-drop_slab_node-with-task-s-memcg/20210402-184123
base: a5e13c6df0e41702d2b2c77c8ad41677ebb065b3
config: mips-randconfig-r006-20210402 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project b23a314146956dd29b719ab537608ced736fc036)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/73abc13485ec57de137f60535b5b2495c0bac570
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Neil-Sun/mm-vmscan-c-drop_slab_node-with-task-s-memcg/20210402-184123
git checkout 73abc13485ec57de137f60535b5b2495c0bac570
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> mm/vmscan.c:705:11: error: implicit declaration of function 'mem_cgroup_from_task' [-Werror,-Wimplicit-function-declaration]
memcg = mem_cgroup_from_task(current);
^
>> mm/vmscan.c:705:9: warning: incompatible integer to pointer conversion assigning to 'struct mem_cgroup *' from 'int' [-Wint-conversion]
memcg = mem_cgroup_from_task(current);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +/mem_cgroup_from_task +705 mm/vmscan.c
693
694 void drop_slab_node(int nid)
695 {
696 unsigned long freed;
697
698 do {
699 struct mem_cgroup *memcg = NULL;
700
701 if (fatal_signal_pending(current))
702 return;
703
704 freed = 0;
> 705 memcg = mem_cgroup_from_task(current);
706 do {
707 freed += shrink_slab(GFP_KERNEL, nid, memcg, 0);
708 } while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
709 } while (freed > 10);
710 }
711
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20960 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm/vmscan.c: drop_slab_node with task's memcg
2021-04-02 10:38 [PATCH] mm/vmscan.c: drop_slab_node with task's memcg Neil Sun
2021-04-02 14:38 ` kernel test robot
@ 2021-04-02 14:50 ` kernel test robot
2021-04-06 7:21 ` Michal Hocko
2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-04-02 14:50 UTC (permalink / raw)
To: Neil Sun, akpm, linux-mm, linux-kernel; +Cc: kbuild-all, Neil Sun
[-- Attachment #1: Type: text/plain, Size: 2663 bytes --]
Hi Neil,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v5.12-rc5]
[also build test ERROR on next-20210401]
[cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Neil-Sun/mm-vmscan-c-drop_slab_node-with-task-s-memcg/20210402-184123
base: a5e13c6df0e41702d2b2c77c8ad41677ebb065b3
config: arm-randconfig-r035-20210401 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/73abc13485ec57de137f60535b5b2495c0bac570
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Neil-Sun/mm-vmscan-c-drop_slab_node-with-task-s-memcg/20210402-184123
git checkout 73abc13485ec57de137f60535b5b2495c0bac570
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
mm/vmscan.c: In function 'drop_slab_node':
>> mm/vmscan.c:705:11: error: implicit declaration of function 'mem_cgroup_from_task'; did you mean 'mem_cgroup_from_obj'? [-Werror=implicit-function-declaration]
705 | memcg = mem_cgroup_from_task(current);
| ^~~~~~~~~~~~~~~~~~~~
| mem_cgroup_from_obj
>> mm/vmscan.c:705:9: warning: assignment to 'struct mem_cgroup *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
705 | memcg = mem_cgroup_from_task(current);
| ^
cc1: some warnings being treated as errors
vim +705 mm/vmscan.c
693
694 void drop_slab_node(int nid)
695 {
696 unsigned long freed;
697
698 do {
699 struct mem_cgroup *memcg = NULL;
700
701 if (fatal_signal_pending(current))
702 return;
703
704 freed = 0;
> 705 memcg = mem_cgroup_from_task(current);
706 do {
707 freed += shrink_slab(GFP_KERNEL, nid, memcg, 0);
708 } while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
709 } while (freed > 10);
710 }
711
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21042 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm/vmscan.c: drop_slab_node with task's memcg
2021-04-02 10:38 [PATCH] mm/vmscan.c: drop_slab_node with task's memcg Neil Sun
2021-04-02 14:38 ` kernel test robot
2021-04-02 14:50 ` kernel test robot
@ 2021-04-06 7:21 ` Michal Hocko
[not found] ` <4dba277d-e497-5c34-0e68-fd2283585de2@yunify.com>
2 siblings, 1 reply; 9+ messages in thread
From: Michal Hocko @ 2021-04-06 7:21 UTC (permalink / raw)
To: Neil Sun; +Cc: akpm, linux-mm, linux-kernel
On Fri 02-04-21 18:38:54, Neil Sun wrote:
> This patch makes shrink_slab() with task's memcg in drop_slab_node(),
> so we can free reclaimable slab objects belongs to memcg /lxc/i-vbe1u8o7
> with following command:
You are changing semantic of the existing user interface. This knob has
never been memcg aware and it is supposed to have a global impact. I do
not think we can simply change that without some users being surprised
or even breaking them.
> cgexec -g memory:/lxc/i-vbe1u8o7 sysctl vm.drop_caches=2
>
> Test with following steps:
>
> root@i-yl0pwrt8:~# free -h
> total used free shared buff/cache available
> Mem: 62Gi 265Mi 62Gi 1.0Mi 290Mi 61Gi
> Swap: 31Gi 0B 31Gi
> root@i-yl0pwrt8:~# (cd /tmp && /root/generate_slab_cache)
> root@i-yl0pwrt8:~# free -h
> total used free shared buff/cache available
> Mem: 62Gi 266Mi 60Gi 1.0Mi 2.2Gi 61Gi
> Swap: 31Gi 0B 31Gi
> root@i-yl0pwrt8:~# cgcreate -g memory:/lxc/i-vbe1u8o7
> root@i-yl0pwrt8:~# cgexec -g memory:/lxc/i-vbe1u8o7 /root/generate_slab_cache
> root@i-yl0pwrt8:~# free -h
> total used free shared buff/cache available
> Mem: 62Gi 267Mi 58Gi 1.0Mi 4.1Gi 61Gi
> Swap: 31Gi 0B 31Gi
> root@i-yl0pwrt8:~# cgexec -g memory:/lxc/i-vbe1u8o7 sysctl vm.drop_caches=2
> vm.drop_caches = 2
> root@i-yl0pwrt8:~# free -h
> total used free shared buff/cache available
> Mem: 62Gi 268Mi 60Gi 1.0Mi 2.2Gi 61Gi
> Swap: 31Gi 0B 31Gi
> root@i-yl0pwrt8:~# sysctl vm.drop_caches=2
> vm.drop_caches = 2
> root@i-yl0pwrt8:~# free -h
> total used free shared buff/cache available
> Mem: 62Gi 267Mi 62Gi 1.0Mi 290Mi 61Gi
> Swap: 31Gi 0B 31Gi
>
> Signed-off-by: Neil Sun <neilsun@yunify.com>
> ---
> mm/vmscan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 562e87cb..81d770a 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -702,7 +702,7 @@ void drop_slab_node(int nid)
> return;
>
> freed = 0;
> - memcg = mem_cgroup_iter(NULL, NULL, NULL);
> + memcg = mem_cgroup_from_task(current);
> do {
> freed += shrink_slab(GFP_KERNEL, nid, memcg, 0);
> } while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
> --
> 2.7.4
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-04-06 17:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 10:38 [PATCH] mm/vmscan.c: drop_slab_node with task's memcg Neil Sun
2021-04-02 14:38 ` kernel test robot
2021-04-02 14:50 ` kernel test robot
2021-04-06 7:21 ` Michal Hocko
[not found] ` <4dba277d-e497-5c34-0e68-fd2283585de2@yunify.com>
2021-04-06 11:39 ` Michal Hocko
2021-04-06 14:34 ` Neil Sun
2021-04-06 14:39 ` Michal Hocko
2021-04-06 15:12 ` Neil Sun
2021-04-06 17:38 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).