From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9E68C433DF for ; Fri, 29 May 2020 10:09:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 699082074D for ; Fri, 29 May 2020 10:09:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b="Y11uIhOm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 699082074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chrisdown.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0134C800C0; Fri, 29 May 2020 06:09:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F05A580010; Fri, 29 May 2020 06:09:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF3CC800C0; Fri, 29 May 2020 06:09:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id C58FB80010 for ; Fri, 29 May 2020 06:09:00 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7C191248D for ; Fri, 29 May 2020 10:09:00 +0000 (UTC) X-FDA: 76869333240.08.sock32_88c8493c38c28 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 5A2171819E76B for ; Fri, 29 May 2020 10:09:00 +0000 (UTC) X-HE-Tag: sock32_88c8493c38c28 X-Filterd-Recvd-Size: 4890 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 29 May 2020 10:08:59 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id x13so2883055wrv.4 for ; Fri, 29 May 2020 03:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EGCTr//CJ/0Q2eA0EeEmXyU8B15617Zs/uV0IexoscQ=; b=Y11uIhOmRXyo7ieDj5COXVZGcR2zPt8sa+tZoxdWPwOhh82K5aMgVHdKX8MwCKQog6 R5xkeI26afEweBp7Mx7N7MkVhsgf+2kKhl8P2I8yKYZyAHWvoHSt/vK1imWNu4m3iKGH pOwGMBJuSK1v0vztOth0Idw9xsAZeoIm1s9KQ= 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:user-agent; bh=EGCTr//CJ/0Q2eA0EeEmXyU8B15617Zs/uV0IexoscQ=; b=BXjCEh75erLoOb+91sQx3oUGqLUPBn+apk457wBWyBp4HxO0yiaoPPxI8RjntLR/dG e0LbcL+4U7gJEcv/7ncb4/6pyFkRiZGLkA4BXWmoQ4FX+pQrtjBWdz6BRLReNLzX3hAM Vz/zLetO7DJVZ3h4Ssmml3fhaAPYgzjz71K1GgO5Y0pG/POFZ0PTdgRDcI/5zBu90tK7 RSgwprPqhyNrn+9HRbAJ3tCQxdgm2M1ZKKwmSnuMrxawLKzgavZ4N9flzadksjJKt1BK xtmMkQ5JBL3+Hl+0Id14gReBWMudjTbaTaR6Y3cXkE8HmmT+6KVKOh/fsM6GH4DzMPCg vv+g== X-Gm-Message-State: AOAM532iLWODSb/igvvb9VAUpbNY+2vdsWyN7MLJsRMiT5BvSfse+GJI cKfT/6L+xwuiItxEmg+e4ntn4w== X-Google-Smtp-Source: ABdhPJz4oOMKF3Tw/lvTsl28+bPqerfZ7GakdrKgkU82JOD5fD05mK5sPA441ncYZFjSEnddQ8N/rQ== X-Received: by 2002:a5d:498b:: with SMTP id r11mr5190933wrq.328.1590746938609; Fri, 29 May 2020 03:08:58 -0700 (PDT) Received: from localhost ([2a01:4b00:8432:8a00:56e1:adff:fe3f:49ed]) by smtp.gmail.com with ESMTPSA id z12sm10088964wrg.9.2020.05.29.03.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 03:08:58 -0700 (PDT) Date: Fri, 29 May 2020 11:08:58 +0100 From: Chris Down To: Michal Hocko 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: <20200529100858.GA98458@chrisdown.name> References: <20200520175135.GA793901@cmpxchg.org> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200529073118.GE4406@dhcp22.suse.cz> User-Agent: Mutt/1.14.2 (2020-05-25) X-Rspamd-Queue-Id: 5A2171819E76B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 :-)