Skip to content

Commit

Permalink
UBUNTU: SAUCE: Revert "mm: memcg/slab: optimize objcg stock draining"
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1918668

This reverts commit 482b2134fda0a74aff66147e777233caede3a0bc, which is commit
3de7d4f upstream.

It is supposed to fix f2fe7b0 ("mm: memcg/slab: charge individual slab
objects instead of pages"), which is not present in groovy kernel at all.

It leads to NULL pointer derefences like:
[ 10.012503] BUG: kernel NULL pointer dereference, address: 0000000000000518
[ 10.030761] #PF: supervisor read access in kernel mode
[ 10.042518] #PF: error_code(0x0000) - not-present page
[ 10.050165] PGD 0 P4D 0
[ 10.077050] Oops: 0000 [#1] SMP PTI
[ 10.081927] CPU: 0 PID: 516 Comm: kexec-load Tainted: G W 5.8.0-45-generic #51
[ 10.092486] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-1 04/01/2014
[ 10.103510] RIP: 0010:__mod_memcg_state.part.0+0xc/0x90

This is possibly caused by a refcount going past 0:
[    5.792689] percpu ref (css_release) <= 0 (-81) after switching to atomic
[    5.792747] WARNING: CPU: 2 PID: 24 at lib/percpu-refcount.c:161 percpu_ref_switch_to_atomic_rcu+0x147/0x160

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and Stefan Bader committed Mar 24, 2021
1 parent 37c3b29 commit 00a22cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2936,7 +2936,9 @@ void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages)
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
page_counter_uncharge(&memcg->kmem, nr_pages);

refill_stock(memcg, nr_pages);
page_counter_uncharge(&memcg->memory, nr_pages);
if (do_memsw_account())
page_counter_uncharge(&memcg->memsw, nr_pages);
}

/**
Expand Down

0 comments on commit 00a22cd

Please sign in to comment.