From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Davydov Subject: Re: [PATCH] mm: memcontrol: fix the return in mem_cgroup_margin Date: Mon, 23 May 2016 13:37:58 +0300 Message-ID: <20160523103758.GB7917@esperanza> References: <1463556255-31892-1-git-send-email-roy.qing.li@gmail.com> <20160518073253.GC21654@dhcp22.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PMWqSIsqmQnuWlFaLSKcgAalh5r5Joup3c4xt8wykKc=; b=Wi6SDyvN6slPAGEnQyVDBYw5gXXYKX994HQOJ/9tzAx0w0I9ewa2MBpsW2JUAV4Ck35yppb+8jGI8LbpBXvHrLmd1l7wNtM1DMS0FCOek1QCRBAQAzK/c5gfSEwhdz0WRKVGISRYMRwHCPE6P0UGzvkJC0CEWDbbBJdyJAlfaZI= Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: Content-Transfer-Encoding: 7bit To: Li RongQing Cc: Michal Hocko , cgroups@vger.kernel.org, linux-mm@kvack.org, Johannes Weiner On Thu, May 19, 2016 at 09:44:53AM +0800, Li RongQing wrote: > On Wed, May 18, 2016 at 3:32 PM, Michal Hocko wrote: > > count should always be smaller than memsw.limit (this is a hard limit). > > Even if we have some temporary breach then the code should work as > > expected because margin is initialized to 0 and memsw.limit >= limit. > > is it possible for this case? for example > > memory count is 500, memory limit is 600; the margin is set to 100 firstly, > then check memory+swap limit, its count(1100) is bigger than its limit(1000), > then the margin 100 is returned wrongly. I guess it is possible, because try_charge forces charging __GFP_NOFAIL allocations, which may result in memsw.limit excess. If we are below memory.limit and there's nothing to reclaim to reduce memsw.usage, we might end up looping in try_charge forever. I've never seen that happen in practice, but I still think the patch is worth applying. Acked-by: Vladimir Davydov -- 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