Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp409466ybm; Fri, 29 May 2020 03:16:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk/2ejz/XmUzm2Q6bWVqU6uFJLVgQSsHRaSynXe7cavwb2MTTQUHZZ7Q+2QIeeWg+TV48o X-Received: by 2002:a17:907:700b:: with SMTP id wr11mr3318615ejb.436.1590747406590; Fri, 29 May 2020 03:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590747406; cv=none; d=google.com; s=arc-20160816; b=vkDX9e44UDABVCmjl25Z7DGzaKKwbqVwHAtcmcNkr5NnrndMV5pmmgCmExTae3KehW KzVS06Az2pQO+uNmHTqvZ3NQDCwxuMJSyPCVR8zywRX7TqXV6fCyV5RKwMshfE8vEAy7 QqlXa+n1YvV/1n70frjcx6L+IlHh0MBKz5SF96Tv+xrGoUKFSaVGqV1eT3Rao9NYv4ck liXAXxGx/6wWeBZzP7jfJH+h26+WF2tGxdAtvG9m4SYGmCTgs8qLWbwYaopjeJV5I9dK zt8X3QilcfHrWH8ieBgL3QbW0iBG08YlP6gxuuBeUjzso92YLPlnsCTIykMOPAs0jLOc FNUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=fjFkfyPnmnUfjK5e2Sor0/7zNo8bV0z4i3upTl22etI=; b=RojHbKhUakwPYLSTaS3p7aPgKN1IczbWwX8L7WfCDS1ZJ11GJmBxGOjqrGy5piniTh RIYMQfbeR3ohs0bV9wyTq0wfOCW+Al/U8pw45jZoaKNFkUKz8b7JZmRU1/7pj1HlS0BJ 9eDEcmwc14TdAewF2Z5dpSBXDqhz+hIDQ6LAqHhfP+/XODQ+HvBcQMy2mR9+I4KuHVoz SH+lW/rp0ssRcTOq32fgfbiRFzgrlO8fHvlto7FaVgcnypIeqgDnmOQzXADAk896FBap KicvYKnUHI34XUf2BXtUcqUwcNqxX83enkQwstZkXfLCkn9fpwfyWv8/vGpSAI+XA0m+ G9Cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si4988173ejb.599.2020.05.29.03.16.23; Fri, 29 May 2020 03:16:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbgE2KOR (ORCPT + 99 others); Fri, 29 May 2020 06:14:17 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:47039 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgE2KOQ (ORCPT ); Fri, 29 May 2020 06:14:16 -0400 Received: by mail-wr1-f65.google.com with SMTP id x6so2804037wrm.13; Fri, 29 May 2020 03:14:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fjFkfyPnmnUfjK5e2Sor0/7zNo8bV0z4i3upTl22etI=; b=SCKcij5o2xoAksurGFnAQCjmwbAATxb99+6DRffbNwxZ0wHQdPIB5gfZif40rqUvYj dily348aNOOiEsvxh5zPqyM3bVvL6XwsnKpJcUlOf6xnApip3J3S009VTOggnEYNUHU4 J0iky8L7NEuIpFHHqneP8xUzC55xM5VC1PlP2a3yYqlVdEdZz2vRO9agqxLEXCI2kNLD u8GX1o1UcDzQRwitBn/GfsPnbOl2BPDMe5XI1P7+U4scCY9LPrRFvjzOTIIDn9X33Dq+ 1uSO6tK0NpbAGtA6rBeI3F/+AM4t8Y9kvIVlDo3we3kg7IMK/4nygpAYP75wdxZihk0b jubQ== X-Gm-Message-State: AOAM531vBN/eo44+u4WjSJRhEKVjR7QJzdxfjmUHKRRfsTyaXOJB7VPA 6i5S5gtN2OYA0TkV1ZheHH8= X-Received: by 2002:a5d:5492:: with SMTP id h18mr7777167wrv.330.1590747254204; Fri, 29 May 2020 03:14:14 -0700 (PDT) Received: from localhost (ip-37-188-178-109.eurotel.cz. [37.188.178.109]) by smtp.gmail.com with ESMTPSA id y17sm5355217wrn.12.2020.05.29.03.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 03:14:13 -0700 (PDT) Date: Fri, 29 May 2020 12:14:12 +0200 From: Michal Hocko To: Chris Down Cc: Johannes Weiner , Andrew Morton , Tejun Heo , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm, memcg: reclaim more aggressively before high allocator throttling Message-ID: <20200529101412.GJ4406@dhcp22.suse.cz> References: <20200521073245.GI6462@dhcp22.suse.cz> <20200521135152.GA810429@cmpxchg.org> <20200521143515.GU6462@dhcp22.suse.cz> <20200521163833.GA813446@cmpxchg.org> <20200521173701.GX6462@dhcp22.suse.cz> <20200521184505.GA815980@cmpxchg.org> <20200528163101.GJ27484@dhcp22.suse.cz> <20200528164848.GB839178@chrisdown.name> <20200529073118.GE4406@dhcp22.suse.cz> <20200529100858.GA98458@chrisdown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200529100858.GA98458@chrisdown.name> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 29-05-20 11:08:58, Chris Down wrote: > Michal Hocko writes: > > > > > task->memcg_nr_pages_over_high is not vague, it's a best-effort > > > > > mechanism to distribute fairness. It's the current task's share of the > > > > > cgroup's overage, and it allows us in the majority of situations to > > > > > distribute reclaim work and sleeps in proportion to how much the task > > > > > is actually at fault. > > > > > > > > Agreed. But this stops being the case as soon as the reclaim target has > > > > been reached and new reclaim attempts are enforced because the memcg is > > > > still above the high limit. Because then you have a completely different > > > > reclaim target - get down to the limit. This would be especially visible > > > > with a large memcg_nr_pages_over_high which could even lead to an over > > > > reclaim. > > > > > > We actually over reclaim even before this patch -- this patch doesn't bring > > > much new in that regard. > > > > > > Tracing try_to_free_pages for a cgroup at the memory.high threshold shows > > > that before this change, we sometimes even reclaim on the order of twice the > > > number of pages requested. For example, I see cases where we requested 1000 > > > pages to be reclaimed, but end up reclaiming 2000 in a single reclaim > > > attempt. > > > > This is interesting and worth looking into. I am aware that we can > > reclaim potentially much more pages during the icache reclaim and that > > there was a heated discussion without any fix merged in the end IIRC. > > Do you have any details? > > Sure, we can look into this more, but let's do it separately from this patch > -- I don't see that its merging should be contingent on that discussion :-) Yes that is a separate issue. -- Michal Hocko SUSE Labs