Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-06 Thread Kirill Tkhai
On 06.12.2017 21:30, Benjamin LaHaise wrote: > On Wed, Dec 06, 2017 at 09:19:09PM +0300, Kirill Tkhai wrote: >> On 06.12.2017 20:44, Benjamin LaHaise wrote: >>> On Wed, Dec 06, 2017 at 06:32:56PM +0100, Oleg Nesterov wrote: >>>>>> This memory lives in page-c

Re: [PATCH] aio: Add memcg accounting of user used data

2017-12-06 Thread Kirill Tkhai
On 06.12.2017 15:43, Michal Hocko wrote: > On Wed 06-12-17 15:36:56, Kirill Tkhai wrote: >> On 06.12.2017 15:23, Michal Hocko wrote: >>> On Tue 05-12-17 13:00:54, Kirill Tkhai wrote: >>> [...] >>>> This meets the problem in case of many containers &g

Re: [PATCH] aio: Add memcg accounting of user used data

2017-12-06 Thread Kirill Tkhai
On 06.12.2017 15:23, Michal Hocko wrote: > On Tue 05-12-17 13:00:54, Kirill Tkhai wrote: > [...] >> This meets the problem in case of many containers >> are used on the hardware node. Since aio_max_nr is >> a global limit, any container may occupy the whole &

Re: [PATCH] aio: Add memcg accounting of user used data

2017-12-06 Thread Kirill Tkhai
On 06.12.2017 12:05, Michal Hocko wrote: > On Tue 05-12-17 19:02:00, Kirill Tkhai wrote: >> On 05.12.2017 18:43, Michal Hocko wrote: >>> On Tue 05-12-17 18:34:59, Kirill Tkhai wrote: >>>> On 05.12.2017 18:15, Michal Hocko wrote: >>>>> On Tue 05-12-17 1

Re: [PATCH] aio: Add memcg accounting of user used data

2017-12-05 Thread Kirill Tkhai
On 05.12.2017 18:43, Michal Hocko wrote: > On Tue 05-12-17 18:34:59, Kirill Tkhai wrote: >> On 05.12.2017 18:15, Michal Hocko wrote: >>> On Tue 05-12-17 13:00:54, Kirill Tkhai wrote: >>>> Currently, number of available aio requests may be >>>> limited onl

Re: [PATCH] aio: Add memcg accounting of user used data

2017-12-05 Thread Kirill Tkhai
On 05.12.2017 18:15, Michal Hocko wrote: > On Tue 05-12-17 13:00:54, Kirill Tkhai wrote: >> Currently, number of available aio requests may be >> limited only globally. There are two sysctl variables >> aio_max_nr and aio_nr, which implement the limitation >> and re

[PATCH] aio: Add memcg accounting of user used data

2017-12-05 Thread Kirill Tkhai
a user of a certain memcg won't be able to allocate more aio requests memory, then the cgroup allows, and he will bumped into the limit. This may be useful for LXC and for protection of some critical microservices. Suggested-by: Tejun Heo <t...@kernel.org> Signed-off-by: Kirill Tkha

Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
On 05.12.2017 01:59, Jeff Moyer wrote: > Kirill Tkhai <ktk...@virtuozzo.com> writes: > >> On 05.12.2017 00:52, Tejun Heo wrote: >>> Hello, Kirill. >>> >>> On Tue, Dec 05, 2017 at 12:44:00AM +0300, Kirill Tkhai wrote: >>>>> Can you p

Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
On 05.12.2017 02:02, Tejun Heo wrote: > Hello, Kirill. > > On Tue, Dec 05, 2017 at 01:49:42AM +0300, Kirill Tkhai wrote: >>> If the only reason is kernel memory consumption protection, the only >>> thing we need to do is making sure that memory used for aio command

Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
On 05.12.2017 00:52, Tejun Heo wrote: > Hello, Kirill. > > On Tue, Dec 05, 2017 at 12:44:00AM +0300, Kirill Tkhai wrote: >>> Can you please explain how this is a fundamental resource which can't >>> be controlled otherwise? >> >> Currently, aio_nr and aio_m

Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
On 05.12.2017 00:35, Jeff Moyer wrote: > Kirill Tkhai <ktk...@virtuozzo.com> writes: > >> Hi, Benjamin, >> >> On 04.12.2017 19:52, Benjamin LaHaise wrote: >>> Hi Kirill, >>> >>> On Mon, Dec 04, 2017 at 07:12:51PM +0300, Kirill Tkhai wrote

Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
Hello, Tejun, On 04.12.2017 23:07, Tejun Heo wrote: > On Mon, Dec 04, 2017 at 07:12:51PM +0300, Kirill Tkhai wrote: >> this patch set introduces accounting aio_nr and aio_max_nr per blkio cgroup. >> It may be used to limit number of aio requests, which are available for >>

Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
Hi, Benjamin, On 04.12.2017 19:52, Benjamin LaHaise wrote: > Hi Kirill, > > On Mon, Dec 04, 2017 at 07:12:51PM +0300, Kirill Tkhai wrote: >> Hi, >> >> this patch set introduces accounting aio_nr and aio_max_nr per blkio cgroup. >> It may be used to li

[PATCH 2/5] aio: Export aio_nr_lock and aio_max_nr initial value to include/linux/aio.h

2017-12-04 Thread Kirill Tkhai
Next patch will use the values in more files, so let's make them visible external. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- fs/aio.c|4 ++-- include/linux/aio.h |4 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/aio.c b/fs/aio.c

[PATCH 1/5] aio: Move aio_nr increment to separate function

2017-12-04 Thread Kirill Tkhai
There is no functional changes, only a preparation for next patches. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- fs/aio.c | 44 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index e6de77

[PATCH 5/5] blkcg: Add cgroup file to configure blkcg::blkg_aio_max_nr

2017-12-04 Thread Kirill Tkhai
Add a file to configure per-cgroup maximum number of available aio requests. Allow write the values, which are less then currently allocated numbers of requests. Show numbers of currently allocated and maximum available requests. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- blo

[PATCH 4/5] blkcg: Charge aio requests in blkio cgroup hierarchy

2017-12-04 Thread Kirill Tkhai
eate/destroy" read locked cgroup_threadgroup_rwsem is used. We take it via cgroup_threadgroup_change_*() interfaces, which are used around the places we charge kioctx::max_reqs and link a ctx to mm_struct::ioctx_table. Single allocation are protected aio_nr_lock like it used before. Si

[PATCH 3/5] blkcg: Add blkcg::blkg_aio_nr and blkcg::blkg_aio_max_nr

2017-12-04 Thread Kirill Tkhai
This adds new members of struct blkcg, which will be used to account numbers of cgroup's aio requests. Also, blkcg_root is used to store sysctl variables aio_nr and aio_max_nr. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- block/blk-cgroup.c |4 fs

[PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup

2017-12-04 Thread Kirill Tkhai
io.aio_nr" file. --- Kirill Tkhai (5): aio: Move aio_nr increment to separate function aio: Export aio_nr_lock and aio_max_nr initial value to include/linux/aio.h blkcg: Add blkcg::blkg_aio_nr and blkcg::blkg_aio_max_nr blkcg: Charge aio requests in blkio cgroup hierar