Re: [External] Re: [PATCH 4/5] mm: memcontrol: move remote memcg charging APIs to CONFIG_MEMCG_KMEM

2021-03-02 Thread Muchun Song
On Tue, Mar 2, 2021 at 9:15 AM Roman Gushchin wrote: > > On Mon, Mar 01, 2021 at 02:22:26PM +0800, Muchun Song wrote: > > The remote memcg charing APIs is a mechanism to charge kernel memory > > to a given memcg. So we can move the infrastructure to the scope of > &g

Re: [External] Re: [PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page

2021-03-02 Thread Muchun Song
On Tue, Mar 2, 2021 at 11:36 AM Shakeel Butt wrote: > > On Mon, Mar 1, 2021 at 7:03 PM Muchun Song wrote: > > > > On Tue, Mar 2, 2021 at 2:11 AM Shakeel Butt wrote: > > > > > > On Sun, Feb 28, 2021 at 10:25 PM Muchun Song > > > wrote: > >

Re: [External] Re: [PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page

2021-03-02 Thread Muchun Song
st. I will reduce the CC list in the next version. Thanks. > > On Mon, Mar 01, 2021 at 10:11:45AM -0800, Shakeel Butt wrote: > > On Sun, Feb 28, 2021 at 10:25 PM Muchun Song > > wrote: > > > > > > We want to reuse the obj_cgroup APIs to reparent the kmem p

Re: [External] Re: [PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page

2021-03-02 Thread Muchun Song
On Tue, Mar 2, 2021 at 2:11 AM Shakeel Butt wrote: > > On Sun, Feb 28, 2021 at 10:25 PM Muchun Song wrote: > > > > We want to reuse the obj_cgroup APIs to reparent the kmem pages when > > the memcg offlined. If we do this, we should store an object cgroup > > point

Re: [External] Re: [PATCH 0/5] Use obj_cgroup APIs to change kmem pages

2021-03-02 Thread Muchun Song
On Tue, Mar 2, 2021 at 9:12 AM Roman Gushchin wrote: > > Hi Muchun! > > On Mon, Mar 01, 2021 at 02:22:22PM +0800, Muchun Song wrote: > > Since Roman series "The new cgroup slab memory controller" applied. All > > slab objects are changed via the new APIs of obj_c

[PATCH 5/5] mm: memcontrol: use object cgroup for remote memory cgroup charging

2021-02-28 Thread Muchun Song
. Actually, the slab core use obj_cgroup APIs for memory cgroup charing, so we can hold a refcount to obj_cgroup instead of memory cgroup. In this case, the infrastructure of remote meory charging also do not hold a refcount to memory cgroup. Signed-off-by: Muchun Song --- fs/buffer.c

[PATCH 4/5] mm: memcontrol: move remote memcg charging APIs to CONFIG_MEMCG_KMEM

2021-02-28 Thread Muchun Song
The remote memcg charing APIs is a mechanism to charge kernel memory to a given memcg. So we can move the infrastructure to the scope of the CONFIG_MEMCG_KMEM. As a bonus, on !CONFIG_MEMCG_KMEM build some functions and variables can be compiled out. Signed-off-by: Muchun Song --- include/linux

[PATCH 3/5] mm: memcontrol: reparent the kmem pages on cgroup removal

2021-02-28 Thread Muchun Song
mem page. Signed-off-by: Muchun Song --- include/linux/memcontrol.h | 66 +++ mm/memcontrol.c| 155 - 2 files changed, 124 insertions(+), 97 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol

[PATCH 1/5] mm: memcontrol: introduce obj_cgroup_{un}charge_page

2021-02-28 Thread Muchun Song
movement without any functional change. Signed-off-by: Muchun Song --- mm/memcontrol.c | 46 +++--- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2db2aeac8a9e..2eafbae504ac 100644 --- a/mm/memcontrol.c

[PATCH 2/5] mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page

2021-02-28 Thread Muchun Song
age_memcg_check in the later patch. Signed-off-by: Muchun Song --- include/linux/memcontrol.h | 56 +++--- mm/memcontrol.c| 23 ++- mm/page_alloc.c| 4 ++-- 3 files changed, 63 insertions(+), 20 deletions(-)

[PATCH 0/5] Use obj_cgroup APIs to change kmem pages

2021-02-28 Thread Muchun Song
cgroup. So I also make it use the APIs of obj_cgroup. Patch 4-5 are doing this. Muchun Song (5): mm: memcontrol: introduce obj_cgroup_{un}charge_page mm: memcontrol: make page_memcg{_rcu} only applicable for non-kmem page mm: memcontrol: reparent the kmem pages on cgroup removal m

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-13 Thread Muchun Song
On Tue, Oct 13, 2020 at 4:09 PM Mike Rapoport wrote: > > On Mon, Oct 12, 2020 at 05:53:01PM +0800, Muchun Song wrote: > > On Mon, Oct 12, 2020 at 5:24 PM Eric Dumazet wrote: > > > > > > On 10/12/20 10:39 AM, Muchun Song wrote: > > > > On Mon, Oct 12, 20

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-12 Thread Muchun Song
On Tue, Oct 13, 2020 at 6:12 AM Cong Wang wrote: > > On Mon, Oct 12, 2020 at 2:53 AM Muchun Song wrote: > > We are not complaining about TCP using too much memory, but how do > > we know that TCP uses a lot of memory. When I firstly face this problem, > > I do not know

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-12 Thread Muchun Song
On Tue, Oct 13, 2020 at 5:47 AM Cong Wang wrote: > > On Sun, Oct 11, 2020 at 9:22 PM Muchun Song wrote: > > > > On Mon, Oct 12, 2020 at 2:39 AM Cong Wang wrote: > > > > > > On Sat, Oct 10, 2020 at 3:39 AM Muchun Song > > > wrote: > > &g

Re: [External] Re: [PATCH] mm: memcontrol: localize mem_cgroup_sockets_enabled() check

2020-10-12 Thread Muchun Song
On Mon, Oct 12, 2020 at 9:59 PM Johannes Weiner wrote: > > On Sat, Oct 10, 2020 at 06:45:21PM +0800, Muchun Song wrote: > > Move the mem_cgroup_sockets_enabled() checks into memcg socket charge > > or uncharge functions, so the users don't have to explicitly check that >

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-12 Thread Muchun Song
On Mon, Oct 12, 2020 at 5:24 PM Eric Dumazet wrote: > > > > On 10/12/20 10:39 AM, Muchun Song wrote: > > On Mon, Oct 12, 2020 at 3:42 PM Eric Dumazet wrote: > >> > >> On Mon, Oct 12, 2020 at 6:22 AM Muchun Song > >> wrote: > >>> >

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-12 Thread Muchun Song
On Mon, Oct 12, 2020 at 3:42 PM Eric Dumazet wrote: > > On Mon, Oct 12, 2020 at 6:22 AM Muchun Song wrote: > > > > On Mon, Oct 12, 2020 at 2:39 AM Cong Wang wrote: > > > > > > On Sat, Oct 10, 2020 at 3:39 AM Muchun Song > > > wrote: > > &g

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-11 Thread Muchun Song
On Mon, Oct 12, 2020 at 2:39 AM Cong Wang wrote: > > On Sat, Oct 10, 2020 at 3:39 AM Muchun Song wrote: > > > > The amount of memory allocated to sockets buffer can become significant. > > However, we do not display the amount of memory consumed by sockets > > buffe

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-11 Thread Muchun Song
On Sun, Oct 11, 2020 at 9:53 PM Mike Rapoport wrote: > > On Sat, Oct 10, 2020 at 06:38:54PM +0800, Muchun Song wrote: > > The amount of memory allocated to sockets buffer can become significant. > > However, we do not display the amount of memory consumed by sockets > &

Re: [External] Re: [PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-10 Thread Muchun Song
On Sun, Oct 11, 2020 at 12:37 AM Randy Dunlap wrote: > > Hi, > > On 10/10/20 3:38 AM, Muchun Song wrote: > > The amount of memory allocated to sockets buffer can become significant. > > However, we do not display the amount of memory consumed by sockets > > buffer. I

[PATCH] mm: proc: add Sock to /proc/meminfo

2020-10-10 Thread Muchun Song
entry_SYSCALL_64_after_hwframe+0x44/0xa9 Signed-off-by: Muchun Song --- drivers/base/node.c | 2 ++ drivers/net/virtio_net.c | 3 +-- fs/proc/meminfo.c| 1 + include/linux/mmzone.h | 1 + include/linux/skbuff.h | 43 ++-- kernel/exit.c

[PATCH] mm: memcontrol: localize mem_cgroup_sockets_enabled() check

2020-10-10 Thread Muchun Song
scope. Signed-off-by: Muchun Song --- include/linux/memcontrol.h | 78 ++--- include/net/sock.h | 5 ++- include/net/tcp.h | 3 +- mm/memcontrol.c | 43 +- net/core/sock.c | 15 +++ net

Re: [External] Re: [RFC PATCH] bpf: Fix potential call bpf_link_free() in atomic context

2020-09-18 Thread Muchun Song
On Fri, Sep 18, 2020 at 6:37 AM Song Liu wrote: > > On Thu, Sep 17, 2020 at 12:46 AM Muchun Song wrote: > > > > The in_atomic macro cannot always detect atomic context. In particular, > > it cannot know about held spinlocks in non-preemptible kernels. Although, &

[RFC PATCH] bpf: Fix potential call bpf_link_free() in atomic context

2020-09-17 Thread Muchun Song
The in_atomic macro cannot always detect atomic context. In particular, it cannot know about held spinlocks in non-preemptible kernels. Although, there is no user call bpf_link_put() with holding spinlock now. Be the safe side, we can avoid this in the feature. Signed-off-by: Muchun Song

[PATCH v2] kprobes: fix NULL pointer dereference at kprobe_ftrace_handler

2020-08-05 Thread Muchun Song
Song Liu Acked-by: Masami Hiramatsu Signed-off-by: Muchun Song Co-developed-by: Chengming Zhou Signed-off-by: Chengming Zhou --- changelogs in v2: 1) fix compiler warning for !CONFIG_KPROBES_ON_FTRACE. kernel/kprobes.c | 24 +--- 1 file changed, 21 insertions(+), 3 d

[PATCH] kprobes: fix compiler warning for !CONFIG_KPROBES_ON_FTRACE

2020-08-05 Thread Muchun Song
race_handler") Signed-off-by: Muchun Song --- kernel/kprobes.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 503add629599..d36e2b017588 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@

Re: [External] Re: [PATCH v2] kprobes: fix NULL pointer dereference at kprobe_ftrace_handler

2020-08-05 Thread Muchun Song
On Thu, Aug 6, 2020 at 12:51 AM Steven Rostedt wrote: > > On Thu, 6 Aug 2020 00:27:13 +0800 > Muchun Song wrote: > > > We found a case of kernel panic on our server. The stack trace is as > > follows(omit some irrelevant information): > > > > BUG: kern

Re: [PATCH] kprobes: fix NULL pointer dereference at kprobe_ftrace_handler

2020-08-02 Thread Muchun Song
Ping guys. Any comments or suggestions? On Tue, Jul 28, 2020 at 2:45 PM Muchun Song wrote: > > We found a case of kernel panic on our server. The stack trace is as > follows(omit some irrelevant information): > > BUG: kernel NULL pointer dereference, address: 008

[PATCH] kprobes: fix NULL pointer dereference at kprobe_ftrace_handler

2020-07-27 Thread Muchun Song
ain, we will not replace ftrace_caller to ftrace_regs_caller because the ftrace is disabled in the step 3). So the step 7) will trigger kernel panic. Fix this problem by disarming the kprobe when the module is going away. Signed-off-by: Muchun Song Co-developed-by: Chengming Zhou Signed-off-by: Chengming Zhou

Re: [External] Re: [PATCH] files: Use rcu lock to get the file structures for better performance

2020-05-22 Thread Muchun Song
On Fri, May 22, 2020 at 12:47 AM Matthew Wilcox wrote: > > On Thu, May 21, 2020 at 08:38:35PM +0800, Muchun Song wrote: > > +++ b/fs/proc/fd.c > > @@ -34,19 +34,27 @@ static int seq_show(struct seq_file *m, void *v) > > if (files) { > > unsign

Re: [External] Re: [PATCH] files: Use rcu lock to get the file structures for better performance

2020-05-21 Thread Muchun Song
On Thu, May 21, 2020 at 11:21 PM Matthew Wilcox wrote: > > On Thu, May 21, 2020 at 08:38:35PM +0800, Muchun Song wrote: > > There is another safe way to get the file structure without > > holding the files->file_lock. That is rcu lock, and this way > > has better perfo

[PATCH] files: Use rcu lock to get the file structures for better performance

2020-05-21 Thread Muchun Song
There is another safe way to get the file structure without holding the files->file_lock. That is rcu lock, and this way has better performance. So use the rcu lock instead of the files->file_lock. Signed-off-by: Muchun Song --- fs/proc/fd.c | 31 ---