Re: [PATCH 4/4] mm: /proc//sys/vm/stat_refresh stop checking monotonic numa stats

2021-02-28 Thread Roman Gushchin
ed-off-by: Hugh Dickins Acked-by: Roman Gushchin Thanks! > --- > > mm/vmstat.c |9 - > 1 file changed, 9 deletions(-) > > --- vmstat3/mm/vmstat.c 2021-02-25 12:42:15.0 -0800 > +++ vmstat4/mm/vmstat.c 2021-02-25 12:44:20.0 -0800 > @@

Re: [PATCH 3/4] mm: /proc/sys/vm/stat_refresh skip checking known negative stats

2021-02-28 Thread Roman Gushchin
on a reasonable sized machine. Does it makes sense? > > Link: https://lore.kernel.org/linux-mm/20200714173747.3315771-1-g...@fb.com/ > Reported-by: Roman Gushchin > Signed-off-by: Hugh Dickins > --- > > mm/vmstat.c | 15 +++ > 1 file changed, 15 insertion

Re: [PATCH 2/4] mm: no more EINVAL from /proc/sys/vm/stat_refresh

2021-02-28 Thread Roman Gushchin
> tests much later to fail, just because their /proc/sys/vm/stat_refresh > touch failed with that error. Stop doing that. Totally agree! > > Signed-off-by: Hugh Dickins Acked-by: Roman Gushchin > --- > > mm/vmstat.c |5 - > 1 file changed, 5 deletions(-) &g

Re: [PATCH 1/4] mm: restore node stat checking in /proc/sys/vm/stat_refresh

2021-02-28 Thread Roman Gushchin
r-node vmstats") > split NR_VM_NODE_STAT_ITEMS out of NR_VM_ZONE_STAT_ITEMS without updating > vmstat_refresh(): so it has been missing out much of the vmstat underflow > checking ever since. Reinstate it. Thanks to Roman Gushchin > for tangentially pointing this out. > >

Re: [PATCH v2] mm: vmstat: fix /proc/sys/vm/stat_refresh generating false warnings

2021-02-25 Thread Roman Gushchin
On Thu, Feb 25, 2021 at 09:21:04AM -0800, Hugh Dickins wrote: > On Wed, 24 Feb 2021, Roman Gushchin wrote: > > On Tue, Feb 23, 2021 at 11:24:23PM -0800, Hugh Dickins wrote: > > > On Thu, 6 Aug 2020, Andrew Morton wrote: > > > > On Thu, 6 Aug 2020 16:38:

Re: [PATCH v2] mm: vmstat: fix /proc/sys/vm/stat_refresh generating false warnings

2021-02-24 Thread Roman Gushchin
On Tue, Feb 23, 2021 at 11:24:23PM -0800, Hugh Dickins wrote: > On Thu, 6 Aug 2020, Andrew Morton wrote: > > On Thu, 6 Aug 2020 16:38:04 -0700 Roman Gushchin wrote: > > August, yikes, I thought it was much more recent. > > > > > > it seems that Hugh and me

Re: [PATCH] mm: memcontrol: fix slub memory accounting

2021-02-23 Thread Roman Gushchin
ot; > which is from memory.stat. Fix it by using mod_lruvec_page_state instead > of mod_node_page_state. > > Fixes: 6a486c0ad4dc ("mm, sl[ou]b: improve memory accounting") > Signed-off-by: Muchun Song Reviewed-by: Roman Gushchin Thanks!

Re: [PATCH] mm: memcontrol: fix get_active_memcg return value

2021-02-23 Thread Roman Gushchin
- memcg = current->active_memcg; > - } > + /* remote memcg must hold a ref. */ > + if (memcg && WARN_ON_ONCE(!css_tryget(>css))) > + memcg = root_mem_cgroup; Ouch, this is a good one! Reviewed-by: Roman Gushchin Thank you!

Re: [v8 PATCH 10/13] mm: vmscan: use per memcg nr_deferred of shrinker

2021-02-16 Thread Roman Gushchin
by boot parameter > > Signed-off-by: Yang Shi LGTM! Acked-by: Roman Gushchin Thanks!

Re: [v8 PATCH 09/13] mm: vmscan: add per memcg shrinker nr_deferred

2021-02-16 Thread Roman Gushchin
ware shrinkers would solve the > unfairness and bring > better isolation. > > When memcg is not enabled (!CONFIG_MEMCG or memcg disabled), the shrinker's > nr_deferred > would be used. And non memcg aware shrinkers use shrinker's nr_deferred all > the time

Re: [v8 PATCH 08/13] mm: vmscan: use a new flag to indicate shrinker is registered

2021-02-16 Thread Roman Gushchin
t; Acked-by: Vlastimil Babka > Signed-off-by: Yang Shi Acked-by: Roman Gushchin > --- > include/linux/shrinker.h | 7 --- > mm/vmscan.c | 40 +++- > 2 files changed, 19 insertions(+), 28 deletions(-) > > diff --gi

Re: [v8 PATCH 05/13] mm: vmscan: use kvfree_rcu instead of call_rcu

2021-02-16 Thread Roman Gushchin
On Tue, Feb 16, 2021 at 04:13:14PM -0800, Yang Shi wrote: > Using kvfree_rcu() to free the old shrinker_maps instead of call_rcu(). > We don't have to define a dedicated callback for call_rcu() anymore. > > Signed-off-by: Yang Shi Acked-by: Roman Gushchin Thanks! > --- >

Re: [LKP] Re: [mm] 10befea91b: hackbench.throughput -62.4% regression

2021-02-12 Thread Roman Gushchin
On Thu, Feb 04, 2021 at 01:19:47PM +0800, Xing Zhengjun wrote: > > > On 2/3/2021 10:49 AM, Roman Gushchin wrote: > > On Tue, Feb 02, 2021 at 04:18:27PM +0800, Xing, Zhengjun wrote: > > > On 1/14/2021 11:18 AM, Roman Gushchin wrote: > > > > On Thu, Jan 14, 2

Re: [v7 PATCH 08/12] mm: vmscan: add per memcg shrinker nr_deferred

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 05:25:16PM -0800, Yang Shi wrote: > On Tue, Feb 9, 2021 at 5:10 PM Roman Gushchin wrote: > > > > On Tue, Feb 09, 2021 at 09:46:42AM -0800, Yang Shi wrote: > > > Currently the number of deferred objects are per shrinker, but some > > > sl

Re: [v7 PATCH 07/12] mm: vmscan: use a new flag to indicate shrinker is registered

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 05:12:51PM -0800, Yang Shi wrote: > On Tue, Feb 9, 2021 at 4:39 PM Roman Gushchin wrote: > > > > On Tue, Feb 09, 2021 at 09:46:41AM -0800, Yang Shi wrote: > > > Currently registered shrinker is indicated by non-NULL > > > shrinker->nr_d

Re: [v7 PATCH 06/12] mm: vmscan: add shrinker_info_protected() helper

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 05:07:07PM -0800, Yang Shi wrote: > On Tue, Feb 9, 2021 at 4:22 PM Roman Gushchin wrote: > > > > On Tue, Feb 09, 2021 at 09:46:40AM -0800, Yang Shi wrote: > > > The shrinker_info is dereferenced in a couple of places via > &g

Re: [v7 PATCH 09/12] mm: vmscan: use per memcg nr_deferred of shrinker

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 09:46:43AM -0800, Yang Shi wrote: > Use per memcg's nr_deferred for memcg aware shrinkers. The shrinker's > nr_deferred > will be used in the following cases: > 1. Non memcg aware shrinkers > 2. !CONFIG_MEMCG > 3. memcg is disabled by boot parameter > >

Re: [v7 PATCH 10/12] mm: vmscan: don't need allocate shrinker->nr_deferred for memcg aware shrinkers

2021-02-09 Thread Roman Gushchin
FIG_MEMCG or memcg > is disabled > by kernel command line, then shrinker's SHRINKER_MEMCG_AWARE flag would be > cleared. > This makes the implementation of this patch simpler. > > Acked-by: Vlastimil Babka > Reviewed-by: Kirill Tkhai > Signed-off-by: Yang Shi Acked

Re: [v7 PATCH 11/12] mm: memcontrol: reparent nr_deferred when memcg offline

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 09:46:45AM -0800, Yang Shi wrote: > Now shrinker's nr_deferred is per memcg for memcg aware shrinkers, add to > parent's > corresponding nr_deferred when memcg offline. > > Acked-by: Vlastimil Babka > Acked-by: Kirill Tkhai > Signed-off-by: Yang

Re: [v7 PATCH 08/12] mm: vmscan: add per memcg shrinker nr_deferred

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 09:46:42AM -0800, Yang Shi wrote: > Currently the number of deferred objects are per shrinker, but some slabs, > for example, > vfs inode/dentry cache are per memcg, this would result in poor isolation > among memcgs. > > The deferred objects typically are generated by

Re: [v7 PATCH 07/12] mm: vmscan: use a new flag to indicate shrinker is registered

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 09:46:41AM -0800, Yang Shi wrote: > Currently registered shrinker is indicated by non-NULL shrinker->nr_deferred. > This approach is fine with nr_deferred at the shrinker level, but the > following > patches will move MEMCG_AWARE shrinkers' nr_deferred to memcg level, so

Re: [v7 PATCH 06/12] mm: vmscan: add shrinker_info_protected() helper

2021-02-09 Thread Roman Gushchin
> + lockdep_is_held(_rwsem)); > +} > + I'd probably drop the "protected" suffix (because there is no unprotected version, right?). Other than that LGTM. Acked-by: Roman Gushchin

Re: [v7 PATCH 05/12] mm: memcontrol: rename shrinker_map to shrinker_info

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 03:33:56PM -0800, Yang Shi wrote: > On Tue, Feb 9, 2021 at 12:50 PM Roman Gushchin wrote: > > > > On Tue, Feb 09, 2021 at 09:46:39AM -0800, Yang Shi wrote: > > > The following patch is going to add nr_deferred into shrinker_map, the >

Re: [v7 PATCH 01/12] mm: vmscan: use nid from shrink_control for tracepoint

2021-02-09 Thread Roman Gushchin
y: Kirill Tkhai > Signed-off-by: Yang Shi Acked-by: Roman Gushchin > --- > mm/vmscan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index b1b574ad199d..b512dd5e3a1c 100644 > --- a/mm/vmscan.c > +++ b/mm/vmsc

Re: [v7 PATCH 02/12] mm: vmscan: consolidate shrinker_maps handling code

2021-02-09 Thread Roman Gushchin
is being stored in a memcg structure. So > move the > shrinker_maps handling code into vmscan.c for tighter integration with > shrinker code, > and remove the "memcg_" prefix. There is no functional change. > > Acked-by: Vlastimil Babka > Acked-by: Kirill Tkhai > S

Re: [PATCH v3 8/8] kselftests: cgroup: update kmem test for new vmstat implementation

2021-02-09 Thread Roman Gushchin
types of memory to the memory.stat side of the > equation, since they're included in memory.current and could throw > false positives. > > Signed-off-by: Johannes Weiner > Reviewed-by: Shakeel Butt Acked-by: Roman Gushchin Thanks!

Re: [v7 PATCH 05/12] mm: memcontrol: rename shrinker_map to shrinker_info

2021-02-09 Thread Roman Gushchin
_one_shrinker_map(struct mem_cgroup > *memcg, > memset(new->map, (int)0xff, old_size); > memset((void *)new->map + old_size, 0, size - old_size); > > - rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, new); > - call_rcu(>rcu, free_shrinker_map_rcu); > + rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_info, new); > + call_rcu(>rcu, free_shrinker_info_rcu); Why not use kvfree_rcu() and get rid of free_shrinker_info_rcu() callback? Aside from this minor thing, the patch looks good to me. Please, feel free to add Acked-by: Roman Gushchin Thanks!

Re: [v7 PATCH 04/12] mm: vmscan: remove memcg_shrinker_map_size

2021-02-09 Thread Roman Gushchin
On Tue, Feb 09, 2021 at 09:46:38AM -0800, Yang Shi wrote: > Both memcg_shrinker_map_size and shrinker_nr_max is maintained, but actually > the > map size can be calculated via shrinker_nr_max, so it seems unnecessary to > keep both. > Remove memcg_shrinker_map_size since shrinker_nr_max is also

Re: [PATCH v3 7/8] mm: memcontrol: consolidate lruvec stat flushing

2021-02-09 Thread Roman Gushchin
gt; just one is being collected, but the rest of the flushing code is the > same. Merge them into one function and share the common code. > > Signed-off-by: Johannes Weiner > Reviewed-by: Shakeel Butt > Acked-by: Michal Hocko Acked-by: Roman Gushchin Thanks!

Re: [v7 PATCH 03/12] mm: vmscan: use shrinker_rwsem to protect shrinker_maps allocation

2021-02-09 Thread Roman Gushchin
;mem_cgroup_online() protects us from it? Yes, sure, > but this is not the thing we want to remember in the future, since this > spreads modularity. > > And a test with heavy paging workload didn't show write lock makes things > worse. > > Acked-by: Vlastimil Babka > A

Re: [PATCH] fs: buffer: use raw page_memcg() on locked page

2021-02-09 Thread Roman Gushchin
ted-by: Muchun Song > Signed-off-by: Johannes Weiner Acked-by: Roman Gushchin Thanks!

Re: [LKP] Re: [mm] 10befea91b: hackbench.throughput -62.4% regression

2021-02-04 Thread Roman Gushchin
On Thu, Feb 04, 2021 at 01:19:47PM +0800, Xing Zhengjun wrote: > > > On 2/3/2021 10:49 AM, Roman Gushchin wrote: > > On Tue, Feb 02, 2021 at 04:18:27PM +0800, Xing, Zhengjun wrote: > > > On 1/14/2021 11:18 AM, Roman Gushchin wrote: > > > > On Thu, Jan 14, 2

Re: [PATCH 7/7] mm: memcontrol: consolidate lruvec stat flushing

2021-02-04 Thread Roman Gushchin
On Thu, Feb 04, 2021 at 04:44:27PM -0500, Johannes Weiner wrote: > On Tue, Feb 02, 2021 at 06:25:30PM -0800, Roman Gushchin wrote: > > On Tue, Feb 02, 2021 at 01:47:46PM -0500, Johannes Weiner wrote: > > > There are two functions to flush the per-cpu data of an lruvec i

Re: [PATCH 1/7] mm: memcontrol: fix cpuhotplug statistics flushing

2021-02-04 Thread Roman Gushchin
On Thu, Feb 04, 2021 at 02:29:57PM -0500, Johannes Weiner wrote: > On Tue, Feb 02, 2021 at 06:28:53PM -0800, Roman Gushchin wrote: > > On Tue, Feb 02, 2021 at 03:07:47PM -0800, Roman Gushchin wrote: > > > On Tue, Feb 02, 2021 at 01:47:40PM -0500, Johannes Weiner wrote: > >

Re: [PATCH 6/7] mm: memcontrol: switch to rstat

2021-02-04 Thread Roman Gushchin
On Thu, Feb 04, 2021 at 11:26:32AM -0500, Johannes Weiner wrote: > On Tue, Feb 02, 2021 at 05:47:26PM -0800, Roman Gushchin wrote: > > On Tue, Feb 02, 2021 at 01:47:45PM -0500, Johannes Weiner wrote: > > > for_each_node(node) { > > > struct mem_cgroup_per

Re: [PATCH v2] mm: memcontrol: replace the loop with a list_for_each_entry()

2021-02-04 Thread Roman Gushchin
.c | 35 --- > 1 file changed, 8 insertions(+), 27 deletions(-) Nice cleanup! Acked-by: Roman Gushchin Thanks.

Re: [LKP] Re: [mm] 10befea91b: hackbench.throughput -62.4% regression

2021-02-02 Thread Roman Gushchin
On Tue, Feb 02, 2021 at 04:18:27PM +0800, Xing, Zhengjun wrote: > > > On 1/14/2021 11:18 AM, Roman Gushchin wrote: > > On Thu, Jan 14, 2021 at 10:51:51AM +0800, kernel test robot wrote: > > > Greeting, > > > > > > FYI, we noticed a -62.4% regression of

Re: [PATCH 1/7] mm: memcontrol: fix cpuhotplug statistics flushing

2021-02-02 Thread Roman Gushchin
On Tue, Feb 02, 2021 at 03:07:47PM -0800, Roman Gushchin wrote: > On Tue, Feb 02, 2021 at 01:47:40PM -0500, Johannes Weiner wrote: > > The memcg hotunplug callback erroneously flushes counts on the local > > CPU, not the counts of the CPU going away; those counts will be lost.

Re: [PATCH 7/7] mm: memcontrol: consolidate lruvec stat flushing

2021-02-02 Thread Roman Gushchin
emcg_online_kmem(struct mem_cgroup *memcg) > { > @@ -5197,7 +5193,7 @@ static void mem_cgroup_free(struct mem_cgroup *memcg) >* Flush percpu lruvec stats to guarantee the value >* correctness on parent's and all ancestor levels. >*/ > - memcg_flush_lruvec_page_state(memcg); > + memcg_flush_lruvec_page_state(memcg, -1); I wonder if adding "cpu" or "percpu" into the function name will make clearer what -1 means? E.g. memcg_flush_(per)cpu_lruvec_stats(memcg, -1). Reviewed-by: Roman Gushchin

Re: [PATCH 6/7] mm: memcontrol: switch to rstat

2021-02-02 Thread Roman Gushchin
* below us. We're in a per-cpu loop here and this is > + * a global counter, so the first cycle will get them. > + */ > + delta = memcg->vmstats.state_pending[i]; > + if (delta) > + memcg->vmstats.state_pending[i] = 0; > + > + /* Add CPU changes on this level since the last flush */ > + v = READ_ONCE(statc->state[i]); > + if (v != statc->state_prev[i]) { > + delta += v - statc->state_prev[i]; > + statc->state_prev[i] = v; > + } > + > + if (!delta) > + continue; > + > + /* Aggregate counts on this level and propagate upwards */ > + memcg->vmstats.state[i] += delta; > + if (parent) > + parent->vmstats.state_pending[i] += delta; > + } > + > + for (i = 0; i < NR_VM_EVENT_ITEMS; i++) { > + delta = memcg->vmstats.events_pending[i]; > + if (delta) > + memcg->vmstats.events_pending[i] = 0; > + > + v = READ_ONCE(statc->events[i]); > + if (v != statc->events_prev[i]) { > + delta += v - statc->events_prev[i]; > + statc->events_prev[i] = v; > + } > + > + if (!delta) > + continue; > + > + memcg->vmstats.events[i] += delta; > + if (parent) > + parent->vmstats.events_pending[i] += delta; > + } > +} > + > #ifdef CONFIG_MMU > /* Handlers for move charge at task migration. */ > static int mem_cgroup_do_precharge(unsigned long count) > @@ -6571,6 +6532,7 @@ struct cgroup_subsys memory_cgrp_subsys = { > .css_released = mem_cgroup_css_released, > .css_free = mem_cgroup_css_free, > .css_reset = mem_cgroup_css_reset, > + .css_rstat_flush = mem_cgroup_css_rstat_flush, > .can_attach = mem_cgroup_can_attach, > .cancel_attach = mem_cgroup_cancel_attach, > .post_attach = mem_cgroup_move_task, > -- > 2.30.0 > With a tiny nit above Reviewed-by: Roman Gushchin . Thanks!

Re: [PATCH 4/7] cgroup: rstat: support cgroup1

2021-02-02 Thread Roman Gushchin
mount, the css moves back to the default hierarchy. Annotate > rebind_subsystems() to move the root css linkage along between roots. > > Signed-off-by: Johannes Weiner Reviewed-by: Roman Gushchin

Re: [PATCH 3/7] mm: memcontrol: privatize memcg_page_state query functions

2021-02-02 Thread Roman Gushchin
On Tue, Feb 02, 2021 at 01:47:42PM -0500, Johannes Weiner wrote: > There are no users outside of the memory controller itself. The rest > of the kernel cares either about node or lruvec stats. > > Signed-off-by: Johannes Weiner Reviewed-by: Roman Gushchin

Re: [PATCH 2/7] mm: memcontrol: kill mem_cgroup_nodeinfo()

2021-02-02 Thread Roman Gushchin
On Tue, Feb 02, 2021 at 01:47:41PM -0500, Johannes Weiner wrote: > No need to encapsulate a simple struct member access. > > Signed-off-by: Johannes Weiner Reviewed-by: Roman Gushchin

Re: [PATCH 1/7] mm: memcontrol: fix cpuhotplug statistics flushing

2021-02-02 Thread Roman Gushchin
are 32 CPUs and 1000 sub-cgroups (which is an absolutely realistic number, because often there are many dying generations of each cgroup), the error margin is 3.9GB. It makes all numbers pretty much random and all possible tests extremely flaky. > > Signed-off-by: Johannes Weiner To this patch

Re: [PATCH v16 08/11] secretmem: add memcg accounting

2021-01-27 Thread Roman Gushchin
On Tue, Jan 26, 2021 at 04:05:55PM +0100, Michal Hocko wrote: > On Tue 26-01-21 14:48:38, Matthew Wilcox wrote: > > On Mon, Jan 25, 2021 at 11:38:17PM +0200, Mike Rapoport wrote: > > > I cannot use __GFP_ACCOUNT because cma_alloc() does not use gfp. > > > Besides, kmem accounting with

Re: [PATCH] mm, slub: remove slub_memcg_sysfs boot param and CONFIG_SLUB_MEMCG_SYSFS_ON

2021-01-27 Thread Roman Gushchin
r-memcg kmem caches > anymore. > > Signed-off-by: Vlastimil Babka Nice cleanup! Acked-by: Roman Gushchin Thanks, Vlastimil! > --- > Documentation/admin-guide/kernel-parameters.txt | 8 > init/Kconfig

Re: [PATCH] Revert "mm: memcontrol: avoid workload stalls when lowering memory.high"

2021-01-22 Thread Roman Gushchin
revert it again. > > Fixes: 536d3bf261a2 ("mm: memcontrol: avoid workload stalls when lowering > memory.high") > Cc: # 5.8+ > Reported-by: Tejun Heo > Signed-off-by: Johannes Weiner Acked-by: Roman Gushchin

Re: [RFC 2/2] mm, slub: add shrinker to reclaim cached slabs

2021-01-21 Thread Roman Gushchin
On Thu, Jan 21, 2021 at 06:21:54PM +0100, Vlastimil Babka wrote: > For performance reasons, SLUB doesn't keep all slabs on shared lists and > doesn't always free slabs immediately after all objects are freed. Namely: > > - for each cache and cpu, there might be a "CPU slab" page, partially or

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-19 Thread Roman Gushchin
gt; > > > On Wed, Jan 13, 2021 at 10:43 AM Roman Gushchin wrote: > > > > > > > > > > On Tue, Jan 12, 2021 at 04:18:44PM -0800, Shakeel Butt wrote: > > > > > > On Tue, Jan 12, 2021 at 4:12 PM Arjun Roy > >

Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high

2021-01-15 Thread Roman Gushchin
On Fri, Jan 15, 2021 at 03:55:36PM -0500, Johannes Weiner wrote: > On Fri, Jan 15, 2021 at 09:03:41AM -0800, Roman Gushchin wrote: > > On Fri, Jan 15, 2021 at 11:20:50AM -0500, Johannes Weiner wrote: > > > On Wed, Jan 13, 2021 at 03:46:54PM +0100, Michal Hocko wrote: > > &

Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high

2021-01-15 Thread Roman Gushchin
On Fri, Jan 15, 2021 at 11:20:50AM -0500, Johannes Weiner wrote: > On Wed, Jan 13, 2021 at 03:46:54PM +0100, Michal Hocko wrote: > > On Tue 12-01-21 11:30:11, Johannes Weiner wrote: > > > When a value is written to a cgroup's memory.high control file, the > > > write() context first tries to

Re: [mm] 10befea91b: hackbench.throughput -62.4% regression

2021-01-13 Thread Roman Gushchin
On Thu, Jan 14, 2021 at 10:51:51AM +0800, kernel test robot wrote: > > Greeting, > > FYI, we noticed a -62.4% regression of hackbench.throughput due to commit: Hi! Commit "mm: memcg/slab: optimize objcg stock draining" (currently only in the mm tree, so no stable hash) should improve the

Re: [bpf] 755e5d5536: BUG:Bad_page_map_in_process

2021-01-13 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 09:27:51PM +0800, kernel test robot wrote: > > Greeting, > > FYI, we noticed the following commit (built with gcc-9): > > commit: 755e5d55367af5ff75a4db9b6cf439416878e2c7 ("bpf: Eliminate > rlimit-based memory accounting for hashtab maps") >

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-13 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 04:12:08PM -0800, Arjun Roy wrote: > On Tue, Jan 12, 2021 at 3:48 PM Roman Gushchin wrote: > > > > On Tue, Jan 12, 2021 at 03:36:18PM -0800, Arjun Roy wrote: > > > On Tue, Jan 12, 2021 at 3:31 PM Roman Gushchin wrote: > > > > > &

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-13 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 04:18:44PM -0800, Shakeel Butt wrote: > On Tue, Jan 12, 2021 at 4:12 PM Arjun Roy wrote: > > > > On Tue, Jan 12, 2021 at 3:48 PM Roman Gushchin wrote: > > > > [snip] > > > Historically we have a corresponding vmstat counter

Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high

2021-01-13 Thread Roman Gushchin
_pages(memcg, nr_pages - high, > - GFP_KERNEL, true); > + try_to_free_mem_cgroup_pages(memcg, nr_pages - high, > + GFP_KERNEL, true); > > - if (!reclaimed && !nr_retries--) > + if (!nr_retries--) > break; > } > > -- > 2.30.0 > Acked-by: Roman Gushchin Thanks!

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 03:36:18PM -0800, Arjun Roy wrote: > On Tue, Jan 12, 2021 at 3:31 PM Roman Gushchin wrote: > > > > On Tue, Jan 12, 2021 at 01:41:05PM -0800, Shakeel Butt wrote: > > > From: Arjun Roy > > > > > > TCP zerocopy receive is use

Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 01:41:05PM -0800, Shakeel Butt 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 network driver is directly mapped into the address

Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 02:45:43PM -0500, Johannes Weiner wrote: > On Tue, Jan 12, 2021 at 09:03:22AM -0800, Roman Gushchin wrote: > > On Tue, Jan 12, 2021 at 11:30:11AM -0500, Johannes Weiner wrote: > > > When a value is written to a cgroup's memory.high control file, the >

Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 04:11:27PM -0500, Johannes Weiner wrote: > On Tue, Jan 12, 2021 at 12:12:37PM -0800, Roman Gushchin wrote: > > On Tue, Jan 12, 2021 at 02:45:43PM -0500, Johannes Weiner wrote: > > > On Tue, Jan 12, 2021 at 09:03:22AM -0800, Roman Gushchin wrote: > >

Re: [PATCH] mm: memcontrol: prevent starvation when writing memory.high

2021-01-12 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 11:30:11AM -0500, Johannes Weiner wrote: > When a value is written to a cgroup's memory.high control file, the > write() context first tries to reclaim the cgroup to size before > putting the limit in place for the workload. Concurrent charges from > the workload can keep

Re: SLUB: percpu partial object count is highly inaccurate, causing some memory wastage and maybe also worse tail latencies?

2021-01-11 Thread Roman Gushchin
On Tue, Jan 12, 2021 at 12:12:47AM +0100, Jann Horn wrote: > [This is not something I intend to work on myself. But since I > stumbled over this issue, I figured I should at least document/report > it, in case anyone is willing to pick it up.] Hi, Jann! Thank you very much for this report! It

Re: [v3 PATCH 02/11] mm: vmscan: consolidate shrinker_maps handling code

2021-01-11 Thread Roman Gushchin
On Mon, Jan 11, 2021 at 11:00:17AM -0800, Yang Shi wrote: > On Wed, Jan 6, 2021 at 4:14 PM Roman Gushchin wrote: > > > > On Tue, Jan 05, 2021 at 02:58:08PM -0800, Yang Shi wrote: > > > The shrinker map management is not really memcg specific, it's just > > >

Re: [PATCH v2 3/3] mm: memcg: add swapcache stat for memcg v2

2021-01-08 Thread Roman Gushchin
keep seeing a consistent view of their usage. > > Signed-off-by: Shakeel Butt > Acked-by: Michal Hocko Reviewed-by: Roman Gushchin Thanks!

[PATCH] mm: kmem: make __memcg_kmem_(un)charge static

2021-01-07 Thread Roman Gushchin
I've noticed that __memcg_kmem_charge() and __memcg_kmem_uncharge() are not used anywhere except memcontrol.c. Yet they are not declared as non-static and are declared in memcontrol.h. This patch makes them static. Signed-off-by: Roman Gushchin --- include/linux/memcontrol.h | 3 --- mm

Re: [v3 PATCH 08/11] mm: vmscan: use per memcg nr_deferred of shrinker

2021-01-06 Thread Roman Gushchin
On Tue, Jan 05, 2021 at 02:58:14PM -0800, Yang Shi wrote: > Use per memcg's nr_deferred for memcg aware shrinkers. The shrinker's > nr_deferred > will be used in the following cases: > 1. Non memcg aware shrinkers > 2. !CONFIG_MEMCG It's better to depend on CONFIG_MEMCG_KMEM rather than

Re: [v3 PATCH 02/11] mm: vmscan: consolidate shrinker_maps handling code

2021-01-06 Thread Roman Gushchin
On Tue, Jan 05, 2021 at 02:58:08PM -0800, Yang Shi wrote: > The shrinker map management is not really memcg specific, it's just allocation In the current form it doesn't look so, especially because each name has a memcg_ prefix and each function takes a memcg argument. It begs for some

Re: [PATCH] mm: memcg/slab: optimize objcg stock draining

2021-01-06 Thread Roman Gushchin
On Wed, Jan 06, 2021 at 11:50:44AM -0800, Andrew Morton wrote: > On Tue, 5 Jan 2021 20:22:39 -0800 Roman Gushchin wrote: > > > Imran Khan reported a regression in hackbench results caused by the > > commit f2fe7b09a52b ("mm: memcg/slab: charge individual slab objec

Re: [PATCH] mm: memcg/slab: optimize objcg stock draining

2021-01-06 Thread Roman Gushchin
On Tue, Jan 05, 2021 at 10:05:20PM -0800, Shakeel Butt wrote: > On Tue, Jan 5, 2021 at 8:22 PM Roman Gushchin wrote: > > > > Imran Khan reported a regression in hackbench results caused by the > > commit f2fe7b09a52b ("mm: memcg/slab: charge individual slab ob

Re: [RFC PATCH] mm/memcontrol: Increase threshold for draining per-cpu stocked bytes.

2021-01-05 Thread Roman Gushchin
On Wed, Jan 06, 2021 at 02:39:05PM +1100, Imran Khan wrote: > On 6/1/21 2:29 pm, Roman Gushchin wrote: > > > On Wed, Jan 06, 2021 at 02:07:12PM +1100, Imran Khan wrote: > > > On 6/1/21 5:45 am, Roman Gushchin wrote: > > > > On Tue, Jan 05, 2021 at 10:23

[PATCH] mm: memcg/slab: optimize objcg stock draining

2021-01-05 Thread Roman Gushchin
faster, so the freeing of page-sized kernel allocations (e.g. large kmallocs) will become faster. A similar change has been done earlier for the socket memory by the commit 475d0487a2ad ("mm: memcontrol: use per-cpu stocks for socket memory uncharging"). Signed-off-by: Roman Gushchin Rep

Re: [RFC PATCH] mm/memcontrol: Increase threshold for draining per-cpu stocked bytes.

2021-01-05 Thread Roman Gushchin
On Wed, Jan 06, 2021 at 02:07:12PM +1100, Imran Khan wrote: > > On 6/1/21 5:45 am, Roman Gushchin wrote: > > On Tue, Jan 05, 2021 at 10:23:52AM -0800, Roman Gushchin wrote: > > > On Tue, Jan 05, 2021 at 04:07:42PM +, Imran Khan wrote: > > > > While allocati

Re: [RFC PATCH] mm/memcontrol: Increase threshold for draining per-cpu stocked bytes.

2021-01-05 Thread Roman Gushchin
On Tue, Jan 05, 2021 at 10:23:52AM -0800, Roman Gushchin wrote: > On Tue, Jan 05, 2021 at 04:07:42PM +, Imran Khan wrote: > > While allocating objects whose size is multiple of PAGE_SIZE, > > say kmalloc-4K, we charge one page for extra bytes corresponding > > to the

Re: [RFC PATCH] mm/memcontrol: Increase threshold for draining per-cpu stocked bytes.

2021-01-05 Thread Roman Gushchin
.8 kernel. The difference is quite impressive! I wonder if you tried smaller values than KMALLOC_MAX_CACHE_SIZE * 2? Let's say 16 and 32? KMALLOC_MAX_CACHE_SIZE * 2 makes sense to me, but then the whole construction with two layer caching is very questionable. Anyway, it's not a reason to not merge your patch, just something I wanna look at later. > > Signed-off-by: Imran Khan Reviewed-by: Roman Gushchin Thanks!

Re: [PATCH] mm/memcontrol: fix warning in mem_cgroup_page_lruvec()

2021-01-04 Thread Roman Gushchin
SM > charge bug, so may be worth keeping: but skip if mem_cgroup_disabled(). > > Fixes: 9a1ac2288cf1 ("mm/memcontrol:rewrite mem_cgroup_page_lruvec()") > Signed-off-by: Hugh Dickins Acked-by: Roman Gushchin Thanks! > --- > > include/linux/memcontrol.h |2 +- >

Re: [PATCH 2/2] mm: memcg: add a new MEMCG_UPDATE_BATCH

2020-12-29 Thread Roman Gushchin
On Tue, Dec 29, 2020 at 10:35:14PM +0800, Feng Tang wrote: > When profiling memory cgroup involved benchmarking, status update > sometimes take quite some CPU cycles. Current MEMCG_CHARGE_BATCH > is used for both charging and statistics/events updating, and is > set to 32, which may be good for

Re: [PATCH 1/2] mm: page_counter: relayout structure to reduce false sharing

2020-12-29 Thread Roman Gushchin
2% > > [1].https://lore.kernel.org/lkml/20201102091543.GM31092@shao2-debian/ > Signed-off-by: Feng Tang > Cc: Roman Gushchin > Cc: Johannes Weiner > --- > include/linux/page_counter.h | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff

Re: [PATCH 1/2] mm: memcg: fix memcg file_dirty numa stat

2020-12-28 Thread Roman Gushchin
gt; for cgroup v2") exposed numa stats for the memcg. So fixing the > file_dirty per-memcg numa stat. > > Fixes: 5f9a4f4a7096 ("mm: memcontrol: add the missing numa_stat interface for > cgroup v2") > Signed-off-by: Shakeel Butt > Cc: Reviewed-by: Roman Gushc

Re: [PATCH v2 1/2] mm: cma: allocate cma areas bottom-up

2020-12-28 Thread Roman Gushchin
On Thu, Dec 24, 2020 at 12:10:39AM +0200, Mike Rapoport wrote: > On Wed, Dec 23, 2020 at 08:35:37AM -0800, Roman Gushchin wrote: > > On Tue, Dec 22, 2020 at 08:06:06PM -0800, Andrew Morton wrote: > > > On Mon, 21 Dec 2020 09:05:51 -0800 Roman Gushchin wrote: > > > >

Re: [PATCH 2/2] mm: fix numa stats for thp migration

2020-12-28 Thread Roman Gushchin
With the typo fix ("__mod_zone_page_tate") Reviewed-by: Roman Gushchin Thanks!

Re: [PATCH v2 1/2] mm: cma: allocate cma areas bottom-up

2020-12-23 Thread Roman Gushchin
On Tue, Dec 22, 2020 at 08:06:06PM -0800, Andrew Morton wrote: > On Mon, 21 Dec 2020 09:05:51 -0800 Roman Gushchin wrote: > > > Subject: [PATCH v3 1/2] mm: cma: allocate cma areas bottom-up > > i386 allmodconfig: > > In file included from ./include/vdso/const.h:5,

Re: INFO: task can't die in shrink_inactive_list (2)

2020-12-21 Thread Roman Gushchin
On Mon, Dec 21, 2020 at 08:33:44PM +, Matthew Wilcox wrote: > On Mon, Dec 21, 2020 at 11:56:36AM -0800, Hugh Dickins wrote: > > On Mon, 23 Nov 2020, Andrew Morton wrote: > > > On Fri, 20 Nov 2020 17:55:22 -0800 syzbot > > > wrote: > > > > > > > Hello, > > > > > > > > syzbot found the

Re: [PATCH v2 1/2] mm: cma: allocate cma areas bottom-up

2020-12-21 Thread Roman Gushchin
On Sun, Dec 20, 2020 at 08:48:48AM +0200, Mike Rapoport wrote: > On Thu, Dec 17, 2020 at 12:12:13PM -0800, Roman Gushchin wrote: > > Currently cma areas without a fixed base are allocated close to the > > end of the node. This placement is sub-optimal because of compaction: >

Re: [PATCH v2 2/2] memblock: do not start bottom-up allocations with kernel_end

2020-12-19 Thread Roman Gushchin
On Sat, Dec 19, 2020 at 11:52:19PM +0900, Wonhyuk Yang wrote: > Hi Roman, > > On Fri, Dec 18, 2020 at 5:12 AM Roman Gushchin wrote: > > > > With kaslr the kernel image is placed at a random place, so starting > > the bottom-up allocation with the kernel_end can

[PATCH v2 2/2] memblock: do not start bottom-up allocations with kernel_end

2020-12-17 Thread Roman Gushchin
gether it simplifies the logic. Signed-off-by: Roman Gushchin --- mm/memblock.c | 49 ++--- 1 file changed, 6 insertions(+), 43 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index b68ee86788af..10bd7d1ef0f4 100644 --- a/mm/memblock.c ++

[PATCH v2 1/2] mm: cma: allocate cma areas bottom-up

2020-12-17 Thread Roman Gushchin
- start with 4GB, by Mike Signed-off-by: Roman Gushchin --- mm/cma.c | 16 1 file changed, 16 insertions(+) diff --git a/mm/cma.c b/mm/cma.c index 7f415d7cda9f..21fd40c092f0 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -337,6 +337,22 @@ int __init cma_declare_contiguous_nid

Re: [v2 PATCH 2/9] mm: memcontrol: use shrinker_rwsem to protect shrinker_maps allocation

2020-12-16 Thread Roman Gushchin
On Wed, Dec 16, 2020 at 08:59:38AM +1100, Dave Chinner wrote: > On Tue, Dec 15, 2020 at 02:53:48PM +0100, Johannes Weiner wrote: > > On Tue, Dec 15, 2020 at 01:09:57PM +1100, Dave Chinner wrote: > > > On Mon, Dec 14, 2020 at 02:37:15PM -0800, Yang Shi wrote: > > > > Since memcg_shrinker_map_size

Re: [PATCH] mm: cma: allocate cma areas bottom-up

2020-12-15 Thread Roman Gushchin
On Tue, Dec 15, 2020 at 11:36:23PM +0200, Mike Rapoport wrote: > Hi Roman, > > On Tue, Dec 15, 2020 at 11:36:15AM -0800, Roman Gushchin wrote: > > Currently cma areas without a fixed base address are allocated > > close to the end of the node. This placement is sub-optim

[PATCH] mm: cma: allocate cma areas bottom-up

2020-12-15 Thread Roman Gushchin
allocation success rates. Signed-off-by: Roman Gushchin --- include/linux/memblock.h | 5 +++-- mm/cma.c | 4 ++-- mm/memblock.c| 26 +++--- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/include/linux/memblock.h b/include/linux

Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-12-14 Thread Roman Gushchin
On Tue, Dec 15, 2020 at 07:21:56AM +1100, Stephen Rothwell wrote: > Hi all, > > On Fri, 4 Dec 2020 20:20:05 +1100 Stephen Rothwell > wrote: > > > > Today's linux-next merge of the akpm-current tree got conflicts in: > > > > include/linux/memcontrol.h > > mm/memcontrol.c > > > > between

Re: [External] Re: [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage

2020-12-08 Thread Roman Gushchin
On Wed, Dec 09, 2020 at 10:31:55AM +0800, Muchun Song wrote: > On Wed, Dec 9, 2020 at 10:21 AM Roman Gushchin wrote: > > > > On Tue, Dec 08, 2020 at 05:51:32PM +0800, Muchun Song wrote: > > > The vmstat threshold is 32 (MEMCG_CHARGE_BATCH), so the type of s32 > >

Re: [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage

2020-12-08 Thread Roman Gushchin
On Tue, Dec 08, 2020 at 06:21:18PM -0800, Roman Gushchin wrote: > On Tue, Dec 08, 2020 at 05:51:32PM +0800, Muchun Song wrote: > > The vmstat threshold is 32 (MEMCG_CHARGE_BATCH), so the type of s32 > > of lruvec_stat_cpu is enough. And introduce struct per_cpu_lruvec_stat > &g

Re: [PATCH v2] mm: memcontrol: optimize per-lruvec stats counter memory usage

2020-12-08 Thread Roman Gushchin
On Tue, Dec 08, 2020 at 05:51:32PM +0800, Muchun Song wrote: > The vmstat threshold is 32 (MEMCG_CHARGE_BATCH), so the type of s32 > of lruvec_stat_cpu is enough. And introduce struct per_cpu_lruvec_stat > to optimize memory usage. > > The size of struct lruvec_stat is 304 bytes on 64 bits

Re: [PATCH v3 1/7] mm: memcontrol: fix NR_ANON_THPS account

2020-12-08 Thread Roman Gushchin
Song > Acked-by: Michal Hocko Reviewed-by: Roman Gushchin Thanks! > --- > mm/memcontrol.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index b80328f52fb4..8818bf64d6fe 100644 > --- a/mm/memcontro

Re: [RESEND PATCH v2 09/12] mm: memcontrol: convert vmstat slab counters to bytes

2020-12-07 Thread Roman Gushchin
On Mon, Dec 07, 2020 at 11:46:22AM -0800, Roman Gushchin wrote: > On Sun, Dec 06, 2020 at 06:14:48PM +0800, Muchun Song wrote: > > the global and per-node counters are stored in pages, however memcg > > and lruvec counters are stored in bytes. This scheme looks weird. > >

Re: [External] Re: [RESEND PATCH v2 00/12] Convert all vmstat counters to pages or bytes

2020-12-07 Thread Roman Gushchin
On Mon, Dec 07, 2020 at 04:02:54PM +0100, Michal Hocko wrote: > On Mon 07-12-20 22:52:30, Muchun Song wrote: > > On Mon, Dec 7, 2020 at 9:00 PM Michal Hocko wrote: > > > > > > On Sun 06-12-20 18:14:39, Muchun Song wrote: > > > > Hi, > > > > > > > > This patch series is aimed to convert all THP

Re: [RESEND PATCH v2 09/12] mm: memcontrol: convert vmstat slab counters to bytes

2020-12-07 Thread Roman Gushchin
On Sun, Dec 06, 2020 at 06:14:48PM +0800, Muchun Song wrote: > the global and per-node counters are stored in pages, however memcg > and lruvec counters are stored in bytes. This scheme looks weird. > So convert all vmstat slab counters to bytes. There is a reason for this weird scheme: percpu

Re: [PATCH v2] mm/memcontrol: make the slab calculation consistent

2020-12-04 Thread Roman Gushchin
> variable of size is already the value of slab_unreclaimable. So we > > do not need to read again. Simplify the code here. > > > > Signed-off-by: Muchun Song > > Acked-by: Roman Gushchin > > I agree that ignoring the ratio right now is not very pretty, b

Re: [PATCH 5/9] mm: memcontrol: add per memcg shrinker nr_deferred

2020-12-03 Thread Roman Gushchin
On Thu, Dec 03, 2020 at 02:49:00PM -0800, Yang Shi wrote: > On Thu, Dec 3, 2020 at 12:07 PM Roman Gushchin wrote: > > > > On Thu, Dec 03, 2020 at 10:03:44AM -0800, Yang Shi wrote: > > > On Wed, Dec 2, 2020 at 8:54 PM Yang Shi wrote: > > > > > > > &g

Re: [PATCH 4/9] mm: vmscan: use a new flag to indicate shrinker is registered

2020-12-03 Thread Roman Gushchin
On Wed, Dec 02, 2020 at 08:59:40PM -0800, Yang Shi wrote: > On Wed, Dec 2, 2020 at 7:01 PM Roman Gushchin wrote: > > > > On Wed, Dec 02, 2020 at 10:27:20AM -0800, Yang Shi wrote: > > > Currently registered shrinker is indicated by non-NULL > > > shrinker->nr_d

<    1   2   3   4   5   6   7   8   9   10   >