From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967527AbeAOM6q (ORCPT + 1 other); Mon, 15 Jan 2018 07:58:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:47326 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965935AbeAOM61 (ORCPT ); Mon, 15 Jan 2018 07:58:27 -0500 Date: Mon, 15 Jan 2018 13:58:24 +0100 From: Michal Hocko To: Andrey Ryabinin Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt Subject: Re: [PATCH v4] mm/memcg: try harder to decrease [memory,memsw].limit_in_bytes Message-ID: <20180115125824.GC22473@dhcp22.suse.cz> References: <20180111104239.GZ1732@dhcp22.suse.cz> <4a8f667d-c2ae-e3df-00fd-edc01afe19e1@virtuozzo.com> <20180111124629.GA1732@dhcp22.suse.cz> <20180111162947.GG1732@dhcp22.suse.cz> <560a77b5-02d7-cbae-35f3-0b20a1c384c2@virtuozzo.com> <20180112122405.GK1732@dhcp22.suse.cz> <7d1b5bfb-f602-8cf4-2de6-dd186484e55c@virtuozzo.com> <20180115124652.GB22473@dhcp22.suse.cz> <17c368ce-3a20-d776-bc11-65b6a5bb1ff7@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17c368ce-3a20-d776-bc11-65b6a5bb1ff7@virtuozzo.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon 15-01-18 15:53:35, Andrey Ryabinin wrote: > > > On 01/15/2018 03:46 PM, Michal Hocko wrote: > > On Mon 15-01-18 15:30:59, Andrey Ryabinin wrote: > >> > >> > >> On 01/12/2018 03:24 PM, Michal Hocko wrote: > >>> On Fri 12-01-18 00:59:38, Andrey Ryabinin wrote: > >>>> On 01/11/2018 07:29 PM, Michal Hocko wrote: > >>> [...] > >>>>> I do not think so. Consider that this reclaim races with other > >>>>> reclaimers. Now you are reclaiming a large chunk so you might end up > >>>>> reclaiming more than necessary. SWAP_CLUSTER_MAX would reduce the over > >>>>> reclaim to be negligible. > >>>>> > >>>> > >>>> I did consider this. And I think, I already explained that sort of race in previous email. > >>>> Whether "Task B" is really a task in cgroup or it's actually a bunch of reclaimers, > >>>> doesn't matter. That doesn't change anything. > >>> > >>> I would _really_ prefer two patches here. The first one removing the > >>> hard coded reclaim count. That thing is just dubious at best. If you > >>> _really_ think that the higher reclaim target is meaningfull then make > >>> it a separate patch. I am not conviced but I will not nack it it either. > >>> But it will make our life much easier if my over reclaim concern is > >>> right and we will need to revert it. Conceptually those two changes are > >>> independent anywa. > >>> > >> > >> Ok, fair point. But what about livelock than? Don't you think that we should > >> go back to something like in V1 patch to prevent it? > > > > I am not sure what do you mean by the livelock here. > > > > Livelock is when tasks in cgroup constantly allocate reclaimable memory at high rate, > and user asked to set too low unreachable limit e.g. 'echo 4096 > memory.limit_in_bytes'. OK, I wasn't sure. The reclaim target, however, doesn't have a direct influence on this, though. > We will loop indefinitely in mem_cgroup_resize_limit(), because try_to_free_mem_cgroup_pages() != 0 > (as long as cgroup tasks generate new reclaimable pages fast enough). I do not thing this is a real problem. The context is interruptible and I would even consider it safer to keep retrying than simply failing prematurely. My experience tells me that basically any hard coded retry loop in the kernel is wrong. -- Michal Hocko SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [PATCH v4] mm/memcg: try harder to decrease [memory,memsw].limit_in_bytes Date: Mon, 15 Jan 2018 13:58:24 +0100 Message-ID: <20180115125824.GC22473@dhcp22.suse.cz> References: <20180111104239.GZ1732@dhcp22.suse.cz> <4a8f667d-c2ae-e3df-00fd-edc01afe19e1@virtuozzo.com> <20180111124629.GA1732@dhcp22.suse.cz> <20180111162947.GG1732@dhcp22.suse.cz> <560a77b5-02d7-cbae-35f3-0b20a1c384c2@virtuozzo.com> <20180112122405.GK1732@dhcp22.suse.cz> <7d1b5bfb-f602-8cf4-2de6-dd186484e55c@virtuozzo.com> <20180115124652.GB22473@dhcp22.suse.cz> <17c368ce-3a20-d776-bc11-65b6a5bb1ff7@virtuozzo.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <17c368ce-3a20-d776-bc11-65b6a5bb1ff7@virtuozzo.com> Sender: owner-linux-mm@kvack.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andrey Ryabinin Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt On Mon 15-01-18 15:53:35, Andrey Ryabinin wrote: > > > On 01/15/2018 03:46 PM, Michal Hocko wrote: > > On Mon 15-01-18 15:30:59, Andrey Ryabinin wrote: > >> > >> > >> On 01/12/2018 03:24 PM, Michal Hocko wrote: > >>> On Fri 12-01-18 00:59:38, Andrey Ryabinin wrote: > >>>> On 01/11/2018 07:29 PM, Michal Hocko wrote: > >>> [...] > >>>>> I do not think so. Consider that this reclaim races with other > >>>>> reclaimers. Now you are reclaiming a large chunk so you might end up > >>>>> reclaiming more than necessary. SWAP_CLUSTER_MAX would reduce the over > >>>>> reclaim to be negligible. > >>>>> > >>>> > >>>> I did consider this. And I think, I already explained that sort of race in previous email. > >>>> Whether "Task B" is really a task in cgroup or it's actually a bunch of reclaimers, > >>>> doesn't matter. That doesn't change anything. > >>> > >>> I would _really_ prefer two patches here. The first one removing the > >>> hard coded reclaim count. That thing is just dubious at best. If you > >>> _really_ think that the higher reclaim target is meaningfull then make > >>> it a separate patch. I am not conviced but I will not nack it it either. > >>> But it will make our life much easier if my over reclaim concern is > >>> right and we will need to revert it. Conceptually those two changes are > >>> independent anywa. > >>> > >> > >> Ok, fair point. But what about livelock than? Don't you think that we should > >> go back to something like in V1 patch to prevent it? > > > > I am not sure what do you mean by the livelock here. > > > > Livelock is when tasks in cgroup constantly allocate reclaimable memory at high rate, > and user asked to set too low unreachable limit e.g. 'echo 4096 > memory.limit_in_bytes'. OK, I wasn't sure. The reclaim target, however, doesn't have a direct influence on this, though. > We will loop indefinitely in mem_cgroup_resize_limit(), because try_to_free_mem_cgroup_pages() != 0 > (as long as cgroup tasks generate new reclaimable pages fast enough). I do not thing this is a real problem. The context is interruptible and I would even consider it safer to keep retrying than simply failing prematurely. My experience tells me that basically any hard coded retry loop in the kernel is wrong. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org