Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1216396
| From | Vladimir Davydov <vdavydov@parallels.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled |
| Date | 2015-08-31 21:30 +0200 |
| Message-ID | <q3CWf-ej-33@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <q3ypA-259-9@gated-at.bofh.it> <q3z2i-33U-5@gated-at.bofh.it> <q3zvj-3E1-5@gated-at.bofh.it> <q3AB6-5ck-43@gated-at.bofh.it> <q3AKL-5CZ-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Aug 31, 2015 at 01:03:09PM -0400, Tejun Heo wrote:
> On Mon, Aug 31, 2015 at 07:51:32PM +0300, Vladimir Davydov wrote:
> ...
> > If we want to allow slab/slub implementation to invoke try_charge
> > wherever it wants, we need to introduce an asynchronous thread doing
> > reclaim when a memcg is approaching its limit (or teach kswapd do that).
>
> In the long term, I think this is the way to go.
Quite probably, or we can use task_work, or direct reclaim instead. It's
not that obvious to me yet which one is the best.
>
> > That's a way to go, but what's the point to complicate things
> > prematurely while it seems we can fix the problem by using the technique
> > similar to the one behind memory.high?
>
> Cuz we're now scattering workarounds to multiple places and I'm sure
> we'll add more try_charge() users (e.g. we want to fold in tcp memcg
> under the same knobs) and we'll have to worry about the same problem
> all over again and will inevitably miss some cases leading to subtle
> failures.
I don't think we will need to insert try_charge_kmem anywhere else,
because all kmem users either allocate memory using kmalloc and friends
or using alloc_pages. kmalloc is accounted. For those who prefer
alloc_pages, there is alloc_kmem_pages helper.
>
> > Nevertheless, even if we introduced such a thread, it'd be just insane
> > to allow slab/slub blindly insert try_charge. Let me repeat the examples
> > of SLAB/SLUB sub-optimal behavior caused by thoughtless usage of
> > try_charge I gave above:
> >
> > - memcg knows nothing about NUMA nodes, so what's the point in failing
> > !__GFP_WAIT allocations used by SLAB while inspecting NUMA nodes?
> > - memcg knows nothing about high order pages, so what's the point in
> > failing !__GFP_WAIT allocations used by SLUB to try to allocate a
> > high order page?
>
> Both are optimistic speculative actions and as long as memcg can
> guarantee that those requests will succeed under normal circumstances,
> as does the system-wide mm does, it isn't a problem.
>
> In general, we want to make sure inside-cgroup behaviors as close to
> system-wide behaviors as possible, scoped but equivalent in kind.
> Doing things differently, while inevitable in certain cases, is likely
> to get messy in the long term.
I totally agree that we should strive to make a kmem user feel roughly
the same in memcg as if it were running on a host with equal amount of
RAM. There are two ways to achieve that:
1. Make the API functions, i.e. kmalloc and friends, behave inside
memcg roughly the same way as they do in the root cgroup.
2. Make the internal memcg functions, i.e. try_charge and friends,
behave roughly the same way as alloc_pages.
I find way 1 more flexible, because we don't have to blindly follow
heuristics used on global memory reclaim and therefore have more
opportunities to achieve the same goal.
Thanks,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-30 21:10 +0200
[PATCH 2/2] mm/slub: do not bypass memcg reclaim for high-order page allocation Vladimir Davydov <vdavydov@parallels.com> - 2015-08-30 21:10 +0200
[PATCH 1/2] mm/slab: skip memcg reclaim only if in atomic context Vladimir Davydov <vdavydov@parallels.com> - 2015-08-30 21:10 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Michal Hocko <mhocko@kernel.org> - 2015-08-31 15:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-08-31 15:50 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-08-31 16:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-31 17:20 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-08-31 17:50 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-31 19:00 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-08-31 19:10 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-31 21:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Christoph Lameter <cl@linux.com> - 2015-08-31 22:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-01 11:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-31 16:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-31 16:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-08-31 16:50 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-08-31 17:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Michal Hocko <mhocko@kernel.org> - 2015-09-01 14:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-01 15:50 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Michal Hocko <mhocko@kernel.org> - 2015-09-01 17:10 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-01 19:00 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Michal Hocko <mhocko@kernel.org> - 2015-09-01 20:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-02 11:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Christoph Lameter <cl@linux.com> - 2015-09-02 20:20 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-03 11:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-09-03 18:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-04 13:20 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-09-04 17:50 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Vladimir Davydov <vdavydov@parallels.com> - 2015-09-04 20:30 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Tejun Heo <tj@kernel.org> - 2015-09-04 21:40 +0200
Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled Michal Hocko <mhocko@kernel.org> - 2015-09-04 16:40 +0200
csiph-web