Re: [PATCH v6 1/2] mm/vmscan: Skip memcg with !usage in shrink_node_memcgs()

2025-04-14 Thread Johannes Weiner
On Mon, Apr 14, 2025 at 08:01:42PM +0200, Michal Koutný wrote: > On Mon, Apr 14, 2025 at 12:47:21PM -0400, Johannes Weiner > wrote: > > It's not a functional change to the protection semantics or the > > reclaim behavior. > > Yes, that's how I understand it, th

Re: [PATCH v6 1/2] mm/vmscan: Skip memcg with !usage in shrink_node_memcgs()

2025-04-14 Thread Johannes Weiner
On Mon, Apr 14, 2025 at 03:55:39PM +0200, Michal Koutný wrote: > On Mon, Apr 14, 2025 at 09:15:57AM -0400, Waiman Long > wrote: > > I did see some low event in the no usage case because of the ">=" comparison > > used in mem_cgroup_below_min(). > > Do you refer to A/B/E or A/B/F from the test? >

Re: [PATCH v4 1/2] mm/vmscan: Skip memcg with !usage in shrink_node_memcgs()

2025-04-07 Thread Johannes Weiner
re in most cases. Though both test_memcg_low > and test_memcg_min sub-tests may still fail occasionally if the > memory.current values fall outside of the expected ranges. > > Suggested-by: Johannes Weiner > Signed-off-by: Waiman Long > --- > mm/vmscan.c

Re: [PATCH v2 1/2] memcg: Don't generate low/min events if either low/min or elow/emin is 0

2025-04-04 Thread Johannes Weiner
On Fri, Apr 04, 2025 at 02:55:35PM -0400, Waiman Long wrote: > On 4/4/25 2:13 PM, Johannes Weiner wrote: > > * Waiman points out that the weirdness is seeing low events without > >having a low configured. Eh, this isn't really true with recursive > >propagation;

Re: [PATCH v2 1/2] memcg: Don't generate low/min events if either low/min or elow/emin is 0

2025-04-04 Thread Johannes Weiner
On Fri, Apr 04, 2025 at 01:25:33PM -0400, Waiman Long wrote: > > On 4/4/25 1:12 PM, Tejun Heo wrote: > > Hello, > > > > On Thu, Apr 03, 2025 at 09:24:34PM -0400, Waiman Long wrote: > > ... > >> The simple and naive fix of changing the operator to ">", however, > >> changes the memory reclaim behav

Re: [PATCH] selftests/sched: add basic test for psi

2024-10-22 Thread Johannes Weiner
y, and such a bug wouldn't hide for very long either. > @@ -18548,10 +18548,12 @@ F: include/uapi/linux/pps.h > PRESSURE STALL INFORMATION (PSI) > M: Johannes Weiner > M: Suren Baghdasaryan > +M: Pintu Kumar $ git log --oneline --author='Pintu Kumar' kerne

Re: [PATCH v4 1/5] mm/memcg: Move mod_objcg_state() to memcontrol.c

2021-04-19 Thread Johannes Weiner
On Mon, Apr 19, 2021 at 01:26:29PM -0400, Waiman Long wrote: > On 4/19/21 1:19 PM, Waiman Long wrote: > > On 4/19/21 1:13 PM, Johannes Weiner wrote: > > > The CONFIG_MEMCG_KMEM has become sort of useless now. It used to be > > > configurable, but now it just means CONFIG

Re: [PATCH v4 1/5] mm/memcg: Move mod_objcg_state() to memcontrol.c

2021-04-19 Thread Johannes Weiner
On Mon, Apr 19, 2021 at 12:18:29PM -0400, Waiman Long wrote: > On 4/19/21 11:21 AM, Waiman Long wrote: > > On 4/19/21 11:14 AM, Johannes Weiner wrote: > > > On Sun, Apr 18, 2021 at 08:00:28PM -0400, Waiman Long wrote: > > > > The mod_objcg_state() function is move

Re: [PATCH v4 4/5] mm/memcg: Save both reclaimable & unreclaimable bytes in object stock

2021-04-19 Thread Johannes Weiner
On Sun, Apr 18, 2021 at 08:00:31PM -0400, Waiman Long wrote: > Currently, the object stock structure caches either reclaimable vmstat > bytes or unreclaimable vmstat bytes in its object stock structure. The > hit rate can be improved if both types of vmstat data can be cached > especially for singl

Re: [PATCH v4 2/5] mm/memcg: Cache vmstat data in percpu memcg_stock_pcp

2021-04-19 Thread Johannes Weiner
On Sun, Apr 18, 2021 at 08:00:29PM -0400, Waiman Long wrote: > Before the new slab memory controller with per object byte charging, > charging and vmstat data update happen only when new slab pages are > allocated or freed. Now they are done with every kmem_cache_alloc() > and kmem_cache_free(). Th

Re: [PATCH v4 1/5] mm/memcg: Move mod_objcg_state() to memcontrol.c

2021-04-19 Thread Johannes Weiner
; + rcu_read_unlock(); > +} It would be more naturally placed next to the others, e.g. below __mod_lruvec_kmem_state(). But no deal breaker if there isn't another revision. Acked-by: Johannes Weiner

Re: [PATCH v3 1/5] mm/memcg: Pass both memcg and lruvec to mod_memcg_lruvec_state()

2021-04-16 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 12:59:21PM -0400, Waiman Long wrote: > On 4/15/21 12:40 PM, Johannes Weiner wrote: > > On Tue, Apr 13, 2021 at 09:20:23PM -0400, Waiman Long wrote: > > > The caller of mod_memcg_lruvec_state() has both memcg and lruvec readily > > > available. So

Re: [PATCH v2 5/8] mm: memcontrol: rename lruvec_holds_page_lru_lock to page_matches_lruvec

2021-04-16 Thread Johannes Weiner
e_memcg() */ With that, Acked-by: Johannes Weiner

Re: [PATCH V2] sched,psi: fix the 'int' underflow for psi

2021-04-16 Thread Johannes Weiner
gracefully since it's not fixing a known bug at this point. Otherwise, Acked-by: Johannes Weiner

Re: [PATCH v3 2/5] mm/memcg: Introduce obj_cgroup_uncharge_mod_state()

2021-04-15 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 03:44:56PM -0400, Waiman Long wrote: > On 4/15/21 3:40 PM, Johannes Weiner wrote: > > On Thu, Apr 15, 2021 at 02:47:31PM -0400, Waiman Long wrote: > > > On 4/15/21 2:10 PM, Johannes Weiner wrote: > > > > On Thu, Apr 15, 2021 at 12:35

Re: [PATCH v3 2/5] mm/memcg: Introduce obj_cgroup_uncharge_mod_state()

2021-04-15 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 02:47:31PM -0400, Waiman Long wrote: > On 4/15/21 2:10 PM, Johannes Weiner wrote: > > On Thu, Apr 15, 2021 at 12:35:45PM -0400, Waiman Long wrote: > > > On 4/15/21 12:30 PM, Johannes Weiner wrote: > > > > On Tue, Apr 13, 2021 at 09:20

Re: [PATCH v3 5/5] mm/memcg: Optimize user context object stock access

2021-04-15 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 02:16:17PM -0400, Waiman Long wrote: > On 4/15/21 1:53 PM, Johannes Weiner wrote: > > On Tue, Apr 13, 2021 at 09:20:27PM -0400, Waiman Long wrote: > > > Most kmem_cache_alloc() calls are from user context. With instrumentation > > > enab

Re: [PATCH v3 3/5] mm/memcg: Cache vmstat data in percpu memcg_stock_pcp

2021-04-15 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 01:08:29PM -0400, Waiman Long wrote: > On 4/15/21 12:50 PM, Johannes Weiner wrote: > > On Tue, Apr 13, 2021 at 09:20:25PM -0400, Waiman Long wrote: > > > Before the new slab memory controller with per object byte charging, > > > charging and vms

Re: [PATCH v3 2/5] mm/memcg: Introduce obj_cgroup_uncharge_mod_state()

2021-04-15 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 12:35:45PM -0400, Waiman Long wrote: > On 4/15/21 12:30 PM, Johannes Weiner wrote: > > On Tue, Apr 13, 2021 at 09:20:24PM -0400, Waiman Long wrote: > > > In memcg_slab_free_hook()/pcpu_memcg_free_hook(), obj_cgroup_uncharge() > > > is

Re: [PATCH v3 5/5] mm/memcg: Optimize user context object stock access

2021-04-15 Thread Johannes Weiner
On Tue, Apr 13, 2021 at 09:20:27PM -0400, Waiman Long wrote: > Most kmem_cache_alloc() calls are from user context. With instrumentation > enabled, the measured amount of kmem_cache_alloc() calls from non-task > context was about 0.01% of the total. > > The irq disable/enable sequence used in this

Re: [PATCH v3 4/5] mm/memcg: Separate out object stock data into its own struct

2021-04-15 Thread Johannes Weiner
On Tue, Apr 13, 2021 at 09:20:26PM -0400, Waiman Long wrote: > The object stock data stored in struct memcg_stock_pcp are independent > of the other page based data stored there. Separating them out into > their own struct to highlight the independency. > > Signed-off-by: Waiman Long > Acked-by:

Re: [PATCH v3 3/5] mm/memcg: Cache vmstat data in percpu memcg_stock_pcp

2021-04-15 Thread Johannes Weiner
On Tue, Apr 13, 2021 at 09:20:25PM -0400, Waiman Long wrote: > Before the new slab memory controller with per object byte charging, > charging and vmstat data update happen only when new slab pages are > allocated or freed. Now they are done with every kmem_cache_alloc() > and kmem_cache_free(). Th

Re: [PATCH v3 1/5] mm/memcg: Pass both memcg and lruvec to mod_memcg_lruvec_state()

2021-04-15 Thread Johannes Weiner
On Tue, Apr 13, 2021 at 09:20:23PM -0400, Waiman Long wrote: > The caller of mod_memcg_lruvec_state() has both memcg and lruvec readily > available. So both of them are now passed to mod_memcg_lruvec_state() > and __mod_memcg_lruvec_state(). The __mod_memcg_lruvec_state() is > updated to allow eith

Re: [PATCH v3 2/5] mm/memcg: Introduce obj_cgroup_uncharge_mod_state()

2021-04-15 Thread Johannes Weiner
On Tue, Apr 13, 2021 at 09:20:24PM -0400, Waiman Long wrote: > In memcg_slab_free_hook()/pcpu_memcg_free_hook(), obj_cgroup_uncharge() > is followed by mod_objcg_state()/mod_memcg_state(). Each of these > function call goes through a separate irq_save/irq_restore cycle. That > is inefficient. Intr

Re: [PATCH] sched,psi: fix the 'int' underflow for psi

2021-04-15 Thread Johannes Weiner
On Thu, Apr 15, 2021 at 07:59:41PM +0530, Charan Teja Reddy wrote: > psi_group_cpu->tasks, represented by the unsigned int, stores the number > of tasks that could be stalled on a psi resource(io/mem/cpu). > Decrementing these counters at zero leads to wrapping which further > leads to the psi_grou

Re: [External] Re: [PATCH 4/7] mm: memcontrol: simplify lruvec_holds_page_lru_lock

2021-04-14 Thread Johannes Weiner
On Wed, Apr 14, 2021 at 06:00:42PM +0800, Muchun Song wrote: > On Wed, Apr 14, 2021 at 5:44 PM Michal Hocko wrote: > > > > On Tue 13-04-21 14:51:50, Muchun Song wrote: > > > We already have a helper lruvec_memcg() to get the memcg from lruvec, we > > > do not need to do it ourselves in the lruvec_

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Johannes Weiner
Hello Yu, On Tue, Apr 13, 2021 at 12:56:17AM -0600, Yu Zhao wrote: > What's new in v2 > > Special thanks to Jens Axboe for reporting a regression in buffered > I/O and helping test the fix. > > This version includes the support of tiers, which represent levels of > usage from fil

Re: [PATCH 6/7] mm: memcontrol: move obj_cgroup_uncharge_pages() out of css_set_lock

2021-04-13 Thread Johannes Weiner
On Tue, Apr 13, 2021 at 02:51:52PM +0800, Muchun Song wrote: > The css_set_lock is used to guard the list of inherited objcgs. So there > is no need to uncharge kernel memory under css_set_lock. Just move it > out of the lock. > > Signed-off-by: Muchun Song Acked-by: Johannes Weiner

Re: [RFC PATCH v2 00/18] Use obj_cgroup APIs to charge the LRU pages

2021-04-12 Thread Johannes Weiner
On Fri, Apr 09, 2021 at 06:29:46PM -0700, Roman Gushchin wrote: > On Fri, Apr 09, 2021 at 08:29:41PM +0800, Muchun Song wrote: > > Since the following patchsets applied. All the kernel memory are charged > > with the new APIs of obj_cgroup. > > > > [v17,00/19] The new cgroup slab memory contro

Re: [PATCH V12 0/3] Charge loop device i/o to issuing cgroup

2021-04-12 Thread Johannes Weiner
It looks like all feedback has been addressed and there hasn't been any new activity on it in a while. As per the suggestion last time [1], Andrew, Jens, could this go through the -mm tree to deal with the memcg conflicts? [1] https://lore.kernel.org/lkml/CALvZod6FMQQC17Zsu9xoKs=dfwajdmc2qk3yidp

Re: [RFC PATCH v2 09/18] mm: vmscan: remove noinline_for_stack

2021-04-09 Thread Johannes Weiner
save stack memory. But the commit 2bcf88796381 ("mm: take pagevecs off > reclaim stack") replace pagevecs by lists of pages_to_free. So we do > not need noinline_for_stack, just remove it (let the compiler decide > whether to inline). > > Signed-off-by: Muchun Song Good

Re: [RFC PATCH v2 06/18] mm: memcontrol: move the objcg infrastructure out of CONFIG_MEMCG_KMEM

2021-04-09 Thread Johannes Weiner
On Fri, Apr 09, 2021 at 08:29:47PM +0800, Muchun Song wrote: > Because memory allocations pinning memcgs for a long time - it exists > at a larger scale and is causing recurring problems in the real world: > page cache doesn't get reclaimed for a long time, or is used by the > second, third, fourth

Re: [RFC PATCH v2 05/18] mm: memcontrol: simplify the logic of objcg pinning memcg

2021-04-09 Thread Johannes Weiner
and it is enough to use WRITE_ONCE(). Good catch. > Signed-off-by: Muchun Song Looks like a nice cleanup / simplification: Acked-by: Johannes Weiner

Re: [RFC PATCH v2 04/18] mm: memcontrol: simplify lruvec_holds_page_lru_lock

2021-04-09 Thread Johannes Weiner
p_disabled() and > CONFIG_MEMCG. > > Signed-off-by: Muchun Song Looks good to me. Acked-by: Johannes Weiner If you haven't done so yet, please make sure to explicitly test with all three config combinations, just because the dummy abstractions for memcg disabled or compiled out

[PATCH] mm: page_counter: mitigate consequences of a page_counter underflow

2021-04-08 Thread Johannes Weiner
orrection inside the spinlock section. I didn't carry it forward into the lockless page counters for simplicity, but it turns out this is quite useful in practice. ] Signed-off-by: Johannes Weiner --- mm/page_counter.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --

Re: [PATCH v2] psi: allow unprivileged users with CAP_SYS_RESOURCE to write psi files

2021-04-02 Thread Johannes Weiner
On Thu, Apr 01, 2021 at 10:58:33PM -0400, Josh Hunt wrote: > Currently only root can write files under /proc/pressure. Relax this to > allow tasks running as unprivileged users with CAP_SYS_RESOURCE to be > able to write to these files. > > Signed-off-by: Josh Hunt > Acked-b

Re: [External] Re: [RFC PATCH 00/15] Use obj_cgroup APIs to charge the LRU pages

2021-04-02 Thread Johannes Weiner
On Thu, Apr 01, 2021 at 10:15:45AM -0700, Shakeel Butt wrote: > On Thu, Apr 1, 2021 at 9:08 AM Muchun Song wrote: > > > [...] > > > The zombie issue is a pretty urgent concern that has caused several > > > production emergencies now. It needs a fix sooner rather than later. > > > > Thank you very

Re: [RFC PATCH 04/15] mm: memcontrol: use lruvec_memcg in lruvec_holds_page_lru_lock

2021-04-02 Thread Johannes Weiner
On Tue, Mar 30, 2021 at 06:15:20PM +0800, Muchun Song wrote: > We already have a helper lruvec_memcg() to get the memcg from lruvec, we > do not need to do it ourselves in the lruvec_holds_page_lru_lock(). So use > lruvec_memcg() instead. > > Signed-off-by: Muchun Song > --- > include/linux/memc

Re: [RFC PATCH 03/15] mm: memcontrol: remove the pgdata parameter of mem_cgroup_page_lruvec

2021-04-02 Thread Johannes Weiner
ve more than one node but not enough space in page->flags to store the nid, and so page_to_nid() is out-of-line and needs to go through section. Those setups aren't really around anymore, and certainly don't justify the hassle (and potential bugs) of the awkward interface. Acked-by: Johannes Weiner

Re: [RFC PATCH 02/15] mm: memcontrol: bail out early when !mm in get_mem_cgroup_from_mm

2021-04-02 Thread Johannes Weiner
ood observation. Acked-by: Johannes Weiner

Re: [RFC PATCH 01/15] mm: memcontrol: fix page charging in page replacement

2021-04-02 Thread Johannes Weiner
m, but > there is a WARN_ON_ONCE in the page_counter_cancel(). Who knows if it > will trigger? So it is better to fix it. > > Signed-off-by: Muchun Song Acked-by: Johannes Weiner

Re: [PATCH] psi: allow unprivileged users with CAP_SYS_RESOURCE to write psi files

2021-04-01 Thread Johannes Weiner
arbitrary code, so I suppose CAP_SYS_RESOURCE is fine. Acked-by: Johannes Weiner

Re: [PATCH v5 00/27] Memory Folios

2021-04-01 Thread Johannes Weiner
On Thu, Apr 01, 2021 at 05:05:37AM +, Al Viro wrote: > On Tue, Mar 30, 2021 at 10:09:29PM +0100, Matthew Wilcox wrote: > > > That's a very Intel-centric way of looking at it. Other architectures > > support a multitude of page sizes, from the insane ia64 (4k, 8k, 16k, then > > every power of

Re: [PATCH v5 00/27] Memory Folios

2021-03-31 Thread Johannes Weiner
On Tue, Mar 30, 2021 at 10:09:29PM +0100, Matthew Wilcox wrote: > On Tue, Mar 30, 2021 at 03:30:54PM -0400, Johannes Weiner wrote: > > Hi Willy, > > > > On Mon, Mar 29, 2021 at 05:58:32PM +0100, Matthew Wilcox wrote: > > > I'm going to respond to some poin

Re: [RFC PATCH 00/15] Use obj_cgroup APIs to charge the LRU pages

2021-03-31 Thread Johannes Weiner
On Tue, Mar 30, 2021 at 03:05:42PM -0700, Roman Gushchin wrote: > On Tue, Mar 30, 2021 at 05:30:10PM -0400, Johannes Weiner wrote: > > On Tue, Mar 30, 2021 at 11:58:31AM -0700, Roman Gushchin wrote: > > > On Tue, Mar 30, 2021 at 11:34:11AM -0700, Shakeel Butt wrote: > > >

Re: [RFC PATCH 00/15] Use obj_cgroup APIs to charge the LRU pages

2021-03-30 Thread Johannes Weiner
On Tue, Mar 30, 2021 at 11:58:31AM -0700, Roman Gushchin wrote: > On Tue, Mar 30, 2021 at 11:34:11AM -0700, Shakeel Butt wrote: > > On Tue, Mar 30, 2021 at 3:20 AM Muchun Song > > wrote: > > > > > > Since the following patchsets applied. All the kernel memory are charged > > > with the new APIs o

Re: [RFC PATCH 00/15] Use obj_cgroup APIs to charge the LRU pages

2021-03-30 Thread Johannes Weiner
On Tue, Mar 30, 2021 at 11:34:11AM -0700, Shakeel Butt wrote: > On Tue, Mar 30, 2021 at 3:20 AM Muchun Song wrote: > > > > Since the following patchsets applied. All the kernel memory are charged > > with the new APIs of obj_cgroup. > > > > [v17,00/19] The new cgroup slab memory controller

Re: [PATCH v5 00/27] Memory Folios

2021-03-30 Thread Johannes Weiner
instances where drivers allocate pages based on buffer_size / PAGE_SIZE and then interact with virtual memory. Those are true VM objects that could grow transparently if PAGE_SIZE grows, and IMO they should share the "fungible memory block" abstraction the VM uses. But there are also man

Re: [PATCH] sched/psi.c: Rudimentary typo fixes

2021-03-26 Thread Johannes Weiner
On Fri, Mar 26, 2021 at 06:12:33PM +0530, Bhaskar Chowdhury wrote: > > s/possible/possible/ > s/ exceution/execution/ > s/manupulations/manipulations/ > > Signed-off-by: Bhaskar Chowdhury > --- > kernel/sched/psi.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/

Re: [PATCH v5 00/27] Memory Folios

2021-03-26 Thread Johannes Weiner
On Wed, Mar 24, 2021 at 06:24:21AM +, Matthew Wilcox wrote: > On Tue, Mar 23, 2021 at 08:29:16PM -0400, Johannes Weiner wrote: > > On Mon, Mar 22, 2021 at 06:47:44PM +, Matthew Wilcox wrote: > > > On Mon, Mar 22, 2021 at 01:59:24PM -0400, Johannes Weiner wrote: >

Re: [mm, net-next v2] mm: net: memcg accounting for TCP rx zerocopy

2021-03-25 Thread Johannes Weiner
On Thu, Mar 25, 2021 at 10:02:28AM +0100, Michal Hocko wrote: > On Wed 24-03-21 15:49:15, Arjun Roy wrote: > > On Wed, Mar 24, 2021 at 2:24 PM Johannes Weiner wrote: > > > > > > On Wed, Mar 24, 2021 at 10:12:46AM +0100, Michal Hocko wrote: > > > > On

Re: [mm, net-next v2] mm: net: memcg accounting for TCP rx zerocopy

2021-03-24 Thread Johannes Weiner
On Wed, Mar 24, 2021 at 10:12:46AM +0100, Michal Hocko wrote: > On Tue 23-03-21 11:47:54, Arjun Roy wrote: > > On Tue, Mar 23, 2021 at 7:34 AM Michal Hocko wrote: > > > > > > On Wed 17-03-21 18:12:55, Johannes Weiner wrote: > > > [...] > >

Re: [PATCH v5 00/27] Memory Folios

2021-03-23 Thread Johannes Weiner
On Mon, Mar 22, 2021 at 06:47:44PM +, Matthew Wilcox wrote: > On Mon, Mar 22, 2021 at 01:59:24PM -0400, Johannes Weiner wrote: > > On Sat, Mar 20, 2021 at 05:40:37AM +, Matthew Wilcox (Oracle) wrote: > > > This series introduces the 'struct folio' as a replac

Re: [PATCH] mm: page_alloc: fix memcg accounting leak in speculative cache lookup

2021-03-23 Thread Johannes Weiner
On Fri, Mar 19, 2021 at 06:52:58PM -0700, Hugh Dickins wrote: > On Fri, 19 Mar 2021, Johannes Weiner wrote: > > > When the freeing of a higher-order page block (non-compound) races > > with a speculative page cache lookup, __free_pages() needs to leave > > the first orde

Re: [mm, net-next v2] mm: net: memcg accounting for TCP rx zerocopy

2021-03-23 Thread Johannes Weiner
On Mon, Mar 22, 2021 at 02:35:11PM -0700, Arjun Roy wrote: > To make sure we're on the same page, then, here's a tentative > mechanism - I'd rather get buy in before spending too much time on > something that wouldn't pass muster afterwards. > > A) An opt-in mechanism, that a driver needs to expli

Re: [PATCH v5 00/27] Memory Folios

2021-03-22 Thread Johannes Weiner
On Sat, Mar 20, 2021 at 05:40:37AM +, Matthew Wilcox (Oracle) wrote: > Managing memory in 4KiB pages is a serious overhead. Many benchmarks > exist which show the benefits of a larger "page size". As an example, > an earlier iteration of this idea which used compound pages got a 7% > performa

Re: [PATCH 2/2] mm: memcontrol: deprecate swapaccounting=0 mode

2021-03-22 Thread Johannes Weiner
On Fri, Mar 19, 2021 at 05:37:05PM -0700, Hugh Dickins wrote: > On Fri, 19 Mar 2021, Johannes Weiner wrote: > > > The swapaccounting= commandline option already does very little > > today. To close a trivial containment failure case, the swap ownership > > tracking part of

Re: [PATCH v5 1/7] mm: memcontrol: slab: fix obtain a reference to a freeing memcg

2021-03-22 Thread Johannes Weiner
xes: 3de7d4f25a74 ("mm: memcg/slab: optimize objcg stock draining") > Signed-off-by: Muchun Song Acked-by: Johannes Weiner Good catch! Did you trigger the WARN_ON() in percpu_ref_kill_and_confirm() during testing?

Re: [PATCH v5 6/7] mm: memcontrol: inline __memcg_kmem_{un}charge() into obj_cgroup_{un}charge_pages()

2021-03-22 Thread Johannes Weiner
nd > call obj_cgroup_uncharge_pages() in obj_cgroup_release(). > > This is just code cleanup without any functionality changes. > > Signed-off-by: Muchun Song Acked-by: Johannes Weiner

Re: [PATCH] psi: reduce calls to sched_clock() in psi

2021-03-22 Thread Johannes Weiner
n two processes > > Total time: 3.329 [sec] > >3.329820 usecs/op > 300316 ops/sec > > Signed-off-by: Shakeel Butt Acked-by: Johannes Weiner

Re: [PATCH 2/2] mm: memcontrol: deprecate swapaccounting=0 mode

2021-03-19 Thread Johannes Weiner
On Fri, Mar 19, 2021 at 06:49:55AM -0700, Shakeel Butt wrote: > On Thu, Mar 18, 2021 at 10:49 PM Johannes Weiner wrote: > > > > The swapaccounting= commandline option already does very little > > today. To close a trivial containment failure case, the swap ownership > >

[PATCH] mm: page_alloc: fix memcg accounting leak in speculative cache lookup

2021-03-19 Thread Johannes Weiner
che patch and adding cgroup accounting of kernel pages. There are no known user reports. A backport to stable is therefor not warranted. Reported-by: Matthew Wilcox Signed-off-by: Johannes Weiner --- mm/page_alloc.c | 33 +++-- 1 file changed, 27 insertions(+)

[PATCH 1/2] mm: memcontrol: don't allocate cgroup swap arrays when memcg is disabled

2021-03-18 Thread Johannes Weiner
. Restore mem_cgroup_disabled() checks, implied previously by cgroup_memory_noswap, in the swapon, swapoff, and swap_entry_free callbacks. Fixes: 2d1c498072de ("mm: memcontrol: make swap tracking an integral part of memory control") Reported-by: Hugh Dickins Signed-off-by: Joha

[PATCH 2/2] mm: memcontrol: deprecate swapaccounting=0 mode

2021-03-18 Thread Johannes Weiner
group2 behavior, memory accounting without swap accounting, memcg runtime disabled). This puts the maintenance overhead of retaining the toggle above its practical benefits. Deprecate it. Suggested-by: Shakeel Butt Signed-off-by: Johannes Weiner --- .../admin-guide/kernel-parameters.txt |

Re: [PATCH v4 4/5] mm: memcontrol: use obj_cgroup APIs to charge kmem pages

2021-03-18 Thread Johannes Weiner
_page_objcg() to get the object > cgroup associated with a kmem page. Or we can use page_memcg() > to get the memory cgroup associated with a kmem page, but caller must > ensure that the returned memcg won't be released (e.g. acquire the > rcu_read_lock or css_set_lock). > > Signed-off-by: Muchun Song Thanks for the updated version, looks good to me! Acked-by: Johannes Weiner

Re: [PATCH v4 3/5] mm: memcontrol: change ug->dummy_page only if memcg changed

2021-03-18 Thread Johannes Weiner
On Thu, Mar 18, 2021 at 07:06:56PM +0800, Muchun Song wrote: > Just like assignment to ug->memcg, we only need to update ug->dummy_page > if memcg changed. So move it to there. This is a very small optimization. > > Signed-off-by: Muchun Song Acked-by: Johannes Weiner

Re: [PATCH v4 2/5] mm: memcontrol: directly access page->memcg_data in mm/page_alloc.c

2021-03-18 Thread Johannes Weiner
ave anything left in there by the time the page is freed, what > we care about is whether the value of page->memcg_data is 0. So just > directly access page->memcg_data here. > > Signed-off-by: Muchun Song Acked-by: Johannes Weiner

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-18 Thread Johannes Weiner
On Thu, Mar 18, 2021 at 03:05:00PM +0100, Michal Hocko wrote: > On Thu 11-03-21 12:37:20, Hugh Dickins wrote: > > On Thu, 11 Mar 2021, Michal Hocko wrote: > > > On Thu 11-03-21 10:21:39, Johannes Weiner wrote: > > > > On Thu, Mar 11, 2021 at 09:37:02AM +0100, Michal H

Re: [PATCH] memcg: set page->private before calling swap_readpage

2021-03-18 Thread Johannes Weiner
On Wed, Mar 17, 2021 at 06:59:59PM -0700, Shakeel Butt wrote: > The function swap_readpage() (and other functions it call) extracts swap > entry from page->private. However for SWP_SYNCHRONOUS_IO, the kernel > skips the swapcache and thus we need to manually set the page->private > with the swap en

Re: [PATCH] memcg: set page->private before calling swap_readpage

2021-03-18 Thread Johannes Weiner
On Thu, Mar 18, 2021 at 03:01:25PM +0100, Michal Hocko wrote: > On Wed 17-03-21 18:59:59, Shakeel Butt wrote: > > The function swap_readpage() (and other functions it call) extracts swap > > entry from page->private. However for SWP_SYNCHRONOUS_IO, the kernel > > skips the swapcache and thus we nee

Re: [mm, net-next v2] mm: net: memcg accounting for TCP rx zerocopy

2021-03-17 Thread Johannes Weiner
On Tue, Mar 16, 2021 at 11:05:11PM -0700, Arjun Roy wrote: > On Tue, Mar 16, 2021 at 3:27 AM Johannes Weiner wrote: > > > > Hello, > > > > On Mon, Mar 15, 2021 at 09:16:45PM -0700, Arjun Roy wrote: > > > From: Arjun Roy > > > > > > TC

Re: [mm, net-next v2] mm: net: memcg accounting for TCP rx zerocopy

2021-03-16 Thread Johannes Weiner
Hello, On Mon, Mar 15, 2021 at 09:16:45PM -0700, Arjun Roy wrote: > From: Arjun Roy > > TCP zerocopy receive is used by high performance network applications > to further scale. For RX zerocopy, the memory containing the network > data filled by the network driver is directly mapped into the add

[PATCH] mm: memcontrol: switch to rstat fix

2021-03-15 Thread Johannes Weiner
ith other memcg flush calls, but without adding another memcg wrapper, inline and drop memcg_flush_vmstats() instead. Signed-off-by: Johannes Weiner --- mm/memcontrol.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c in

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

2021-03-12 Thread Johannes Weiner
On Fri, Mar 12, 2021 at 02:42:45PM -0800, Shakeel Butt wrote: > Hi Johannes, > > On Fri, Mar 12, 2021 at 11:23 AM Johannes Weiner wrote: > > > [...] > > > > Longer term we most likely need it there anyway. The issue you are > > describing in the cover lette

Re: [PATCH v3 4/4] mm: memcontrol: move PageMemcgKmem to the scope of CONFIG_MEMCG_KMEM

2021-03-12 Thread Johannes Weiner
> Signed-off-by: Muchun Song Acked-by: Johannes Weiner

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

2021-03-12 Thread Johannes Weiner
Hello Muchun, On Fri, Mar 12, 2021 at 03:14:07PM +0800, Muchun Song wrote: > On Thu, Mar 11, 2021 at 9:12 PM Johannes Weiner wrote: > > > @@ -358,14 +358,26 @@ enum page_memcg_data_flags { > > > > > > #define MEMCG_DATA_FLAGS_MASK (__NR_MEMCG_DATA_FLAGS - 1) &

Re: [External] Re: [PATCH v3 3/4] mm: memcontrol: use obj_cgroup APIs to charge kmem pages

2021-03-12 Thread Johannes Weiner
On Fri, Mar 12, 2021 at 05:22:55PM +0800, Muchun Song wrote: > On Thu, Mar 11, 2021 at 6:05 AM Johannes Weiner wrote: > > > @@ -6828,7 +6857,7 @@ static void uncharge_batch(const struct > > > uncharge_gather *ug) > > > > > > static void uncharge_page(st

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-11 Thread Johannes Weiner
On Thu, Mar 11, 2021 at 09:37:02AM +0100, Michal Hocko wrote: > Johannes, Hugh, > > what do you think about this approach? If we want to stick with > split_page approach then we need to update the missing place Matthew has > pointed out. I find the __free_pages() code quite tricky as well. But fo

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

2021-03-11 Thread Johannes Weiner
On Tue, Mar 09, 2021 at 06:07:15PM +0800, Muchun Song wrote: > We want to reuse the obj_cgroup APIs to charge the kmem pages. > If we do that, we should store an object cgroup pointer to > page->memcg_data for the kmem pages. > > Finally, page->memcg_data can have 3 different meanings. > > 1) F

Re: [PATCH v3 1/4] mm: memcontrol: introduce obj_cgroup_{un}charge_pages

2021-03-11 Thread Johannes Weiner
es to a object cgroup. This is just > a code movement without any functional changes. > > Signed-off-by: Muchun Song > Acked-by: Roman Gushchin Acked-by: Johannes Weiner

Re: [PATCH v3 3/4] mm: memcontrol: use obj_cgroup APIs to charge kmem pages

2021-03-10 Thread Johannes Weiner
Hello Munchun, On Tue, Mar 09, 2021 at 06:07:16PM +0800, Muchun Song wrote: > @@ -6806,11 +6823,23 @@ static inline void uncharge_gather_clear(struct > uncharge_gather *ug) > static void uncharge_batch(const struct uncharge_gather *ug) > { > unsigned long flags; > + unsigned long nr_p

Re: [PATCH V6] x86/mm: Tracking linear mapping split events

2021-03-08 Thread Johannes Weiner
On Fri, Mar 05, 2021 at 04:57:15PM -0800, Andrew Morton wrote: > On Thu, 18 Feb 2021 15:57:44 -0800 Saravanan D wrote: > > > To help with debugging the sluggishness caused by TLB miss/reload, > > we introduce monotonic hugepage [direct mapped] split event counts since > > system state: SYSTEM_RUN

[tip: sched/core] psi: Pressure states are unlikely

2021-03-06 Thread tip-bot2 for Johannes Weiner
The following commit has been merged into the sched/core branch of tip: Commit-ID: fddc8bab531e217806b84906681324377d741c6c Gitweb: https://git.kernel.org/tip/fddc8bab531e217806b84906681324377d741c6c Author:Johannes Weiner AuthorDate:Wed, 03 Mar 2021 11:46:58 +08:00

Re: [PATCH v3] memcg: charge before adding to swapcache on swapin

2021-03-05 Thread Johannes Weiner
On Fri, Mar 05, 2021 at 08:42:00AM -0800, Shakeel Butt wrote: > On Fri, Mar 5, 2021 at 8:25 AM Johannes Weiner wrote: > > > [...] > > I'd also rename cgroup_memory_noswap to cgroup_swapaccount - to match > > the commandline and (hopefully) make a bit clearer what

Re: [PATCH v3] memcg: charge before adding to swapcache on swapin

2021-03-05 Thread Johannes Weiner
On Fri, Mar 05, 2021 at 12:06:31AM -0800, Hugh Dickins wrote: > On Wed, 3 Mar 2021, Shakeel Butt wrote: > > > Currently the kernel adds the page, allocated for swapin, to the > > swapcache before charging the page. This is fine but now we want a > > per-memcg swapcache stat which is essential for

Re: [PATCH v2 2/2] mm/memcg: set memcg when split page

2021-03-04 Thread Johannes Weiner
harged. > > Therefore, the memcg of the tail page needs to be set when split page. > > Signed-off-by: Zhou Guanghui Acked-by: Johannes Weiner

Re: [PATCH v2 1/2] mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg

2021-03-04 Thread Johannes Weiner
info(memcg and flag) of > the memcg needs to be set to the tail pages. > > Signed-off-by: Zhou Guanghui Acked-by: Johannes Weiner

Re: [PATCH v3] memcg: charge before adding to swapcache on swapin

2021-03-04 Thread Johannes Weiner
up_charge_swapin_page(), > adds the page to the swapcache and on success completes the charging > process with mem_cgroup_finish_swapin_page(). > > Signed-off-by: Shakeel Butt The patch looks good to me, I have just a minor documentation nit below. But with that addressed, please

[tip: sched/core] psi: Pressure states are unlikely

2021-03-04 Thread tip-bot2 for Johannes Weiner
The following commit has been merged into the sched/core branch of tip: Commit-ID: 24f3cb558f59debe0e9159459bb9627b51b47c17 Gitweb: https://git.kernel.org/tip/24f3cb558f59debe0e9159459bb9627b51b47c17 Author:Johannes Weiner AuthorDate:Wed, 03 Mar 2021 11:46:58 +08:00

Re: [PATCH v2 0/4] psi: Add PSI_CPU_FULL state and some code optimization

2021-03-03 Thread Johannes Weiner
On Wed, Mar 03, 2021 at 05:05:15PM +0100, Peter Zijlstra wrote: > On Wed, Mar 03, 2021 at 04:32:18PM +0100, Peter Zijlstra wrote: > > > Yes, I can do that. Thanks! > > Please double check the patches as found here: > > > https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/log/?h=

Re: [PATCH v2] mm: memcontrol: fix kernel stack account

2021-03-03 Thread Johannes Weiner
f-by: Muchun Song > Reviewed-by: Shakeel Butt With changes proposed by Shakeel and Michal, this looks good to me. Acked-by: Johannes Weiner I guess the BUG_ON() was inspired by memcg_charge_kernel_stack() - not really your fault for following that example. But yeah, please drop it from your patch. Thanks!

Re: [PATCH v2 0/4] psi: Add PSI_CPU_FULL state and some code optimization

2021-03-03 Thread Johannes Weiner
change() for every common cgroup ancestor of the two tasks. > > Chengming Zhou (3): > psi: Add PSI_CPU_FULL state > psi: Use ONCPU state tracking machinery to detect reclaim > psi: Optimize task switch inside shared cgroups > > Johannes Weiner (1): > psi: pressure st

Re: [PATCH v2 2/4] psi: Use ONCPU state tracking machinery to detect reclaim

2021-03-03 Thread Johannes Weiner
f bench, the performace and cost > changes would be acceptable for real workloads. > > Thanks to Johannes Weiner for pointing out the psi_task_switch() > optimization things and the clearer changelog. > > Signed-off-by: Muchun Song > Signed-off-by: Chengming Zhou Acked-by: Johannes Weiner

Re: [PATCH v2 4/4] psi: Optimize task switch inside shared cgroups

2021-03-03 Thread Johannes Weiner
leep switches to another task, we remove one call of > psi_group_change() for every common cgroup ancestor of the two tasks. > > Signed-off-by: Muchun Song > Signed-off-by: Chengming Zhou Acked-by: Johannes Weiner

Re: [PATCH] mm/memcg: set memcg when split pages

2021-03-03 Thread Johannes Weiner
On Tue, Mar 02, 2021 at 12:24:41PM -0800, Hugh Dickins wrote: > On Tue, 2 Mar 2021, Michal Hocko wrote: > > [Cc Johannes for awareness and fixup Nick's email] > > > > On Tue 02-03-21 01:34:51, Zhou Guanghui wrote: > > > When split page, the memory cgroup info recorded in first page is > > > not co

Re: [PATCH] mm: introduce clear all vm events counters

2021-03-02 Thread Johannes Weiner
On Tue, Mar 02, 2021 at 04:00:34PM +0530, pi...@codeaurora.org wrote: > On 2021-03-01 20:41, Johannes Weiner wrote: > > On Mon, Mar 01, 2021 at 04:19:26PM +0530, Pintu Kumar wrote: > > > At times there is a need to regularly monitor vm counters while we > > > reproduce

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

2021-03-01 Thread Johannes Weiner
Muchun, can you please reduce the CC list to mm/memcg folks only for the next submission? I think probably 80% of the current recipients don't care ;-) 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

Re: [PATCH] mm: introduce clear all vm events counters

2021-03-01 Thread Johannes Weiner
On Mon, Mar 01, 2021 at 04:19:26PM +0530, Pintu Kumar wrote: > At times there is a need to regularly monitor vm counters while we > reproduce some issue, or it could be as simple as gathering some system > statistics when we run some scenario and every time we like to start from > beginning. > The

Re: [v8 PATCH 00/13] Make shrinker's nr_deferred memcg aware

2021-03-01 Thread Johannes Weiner
Hello Yang, On Thu, Feb 25, 2021 at 09:00:16AM -0800, Yang Shi wrote: > Hi Andrew, > > Just checking in whether this series is on your radar. The patch 1/13 > ~ patch 12/13 have been reviewed and acked. Vlastimil had had some > comments on patch 13/13, I'm not sure if he is going to continue > re

Re: [PATCH] memcg: cleanup root memcg checks

2021-02-24 Thread Johannes Weiner
On Tue, Feb 23, 2021 at 12:56:25PM -0800, Shakeel Butt wrote: > Replace the implicit checking of root memcg with explicit root memcg > checking i.e. !css->parent with mem_cgroup_is_root(). > > Signed-off-by: Shakeel Butt Acked-by: Johannes Weiner

  1   2   3   4   5   6   7   8   9   10   >