Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1723269 > unrolled thread
| Started by | Michal Hocko <mhocko@kernel.org> |
|---|---|
| First post | 2017-08-30 14:40 +0200 |
| Last post | 2017-08-30 16:30 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] mm: memcontrol: use per-cpu stocks for socket memory uncharging Michal Hocko <mhocko@kernel.org> - 2017-08-30 14:40 +0200
Re: [PATCH] mm: memcontrol: use per-cpu stocks for socket memory uncharging Michal Hocko <mhocko@kernel.org> - 2017-08-30 15:00 +0200
Re: [PATCH] mm: memcontrol: use per-cpu stocks for socket memory uncharging Michal Hocko <mhocko@kernel.org> - 2017-08-30 16:30 +0200
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-08-30 14:40 +0200 |
| Subject | Re: [PATCH] mm: memcontrol: use per-cpu stocks for socket memory uncharging |
| Message-ID | <ukarM-8kx-5@gated-at.bofh.it> |
On Tue 29-08-17 11:01:50, Roman Gushchin wrote: [...] > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index b9cf3cf4a3d0..a69d23082abf 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1792,6 +1792,9 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) > } > stock->nr_pages += nr_pages; > > + if (stock->nr_pages > CHARGE_BATCH) > + drain_stock(stock); > + > local_irq_restore(flags); > } Why do we need this? In other words, why cannot we rely on draining we already do? > > @@ -5886,8 +5889,7 @@ void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages) > > this_cpu_sub(memcg->stat->count[MEMCG_SOCK], nr_pages); > > - page_counter_uncharge(&memcg->memory, nr_pages); > - css_put_many(&memcg->css, nr_pages); > + refill_stock(memcg, nr_pages); > } This makes sense to me. -- Michal Hocko SUSE Labs
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-08-30 15:00 +0200 |
| Message-ID | <ukaL8-8rd-29@gated-at.bofh.it> |
| In reply to | #1723269 |
On Wed 30-08-17 13:44:59, Roman Gushchin wrote: > On Wed, Aug 30, 2017 at 02:36:55PM +0200, Michal Hocko wrote: > > On Tue 29-08-17 11:01:50, Roman Gushchin wrote: > > [...] > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > > index b9cf3cf4a3d0..a69d23082abf 100644 > > > --- a/mm/memcontrol.c > > > +++ b/mm/memcontrol.c > > > @@ -1792,6 +1792,9 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) > > > } > > > stock->nr_pages += nr_pages; > > > > > > + if (stock->nr_pages > CHARGE_BATCH) > > > + drain_stock(stock); > > > + > > > local_irq_restore(flags); > > > } > > > > Why do we need this? In other words, why cannot we rely on draining we > > already do? > > The existing draining depends on memory pressure, so to keep > the accounting (which we expose to a user) reasonable accurate > even without memory pressure, we need to limit the size of per-cpu stocks. Why don't we need this for regular page charges? Or maybe we do but that sounds like a seprate and an unrealted fix to me. -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2017-08-30 16:30 +0200 |
| Message-ID | <ukcae-ZN-29@gated-at.bofh.it> |
| In reply to | #1723288 |
On Wed 30-08-17 13:57:29, Roman Gushchin wrote: > On Wed, Aug 30, 2017 at 02:55:43PM +0200, Michal Hocko wrote: > > On Wed 30-08-17 13:44:59, Roman Gushchin wrote: > > > On Wed, Aug 30, 2017 at 02:36:55PM +0200, Michal Hocko wrote: > > > > On Tue 29-08-17 11:01:50, Roman Gushchin wrote: > > > > [...] > > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > > > > index b9cf3cf4a3d0..a69d23082abf 100644 > > > > > --- a/mm/memcontrol.c > > > > > +++ b/mm/memcontrol.c > > > > > @@ -1792,6 +1792,9 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) > > > > > } > > > > > stock->nr_pages += nr_pages; > > > > > > > > > > + if (stock->nr_pages > CHARGE_BATCH) > > > > > + drain_stock(stock); > > > > > + > > > > > local_irq_restore(flags); > > > > > } > > > > > > > > Why do we need this? In other words, why cannot we rely on draining we > > > > already do? > > > > > > The existing draining depends on memory pressure, so to keep > > > the accounting (which we expose to a user) reasonable accurate > > > even without memory pressure, we need to limit the size of per-cpu stocks. > > > > Why don't we need this for regular page charges? Or maybe we do but that > > sounds like a seprate and an unrealted fix to me. > > Because we never refill more than CHARGE_BATCH. You are right that a single process will not but try_charge is a preemptible context and so multiple processes might pass consume_stock and then charge a N*CHARGE_BATCH. But I agree that this is quite unlikely so a separate patch is probably not worth it. -- Michal Hocko SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web