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=-14.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 E0403C43446 for ; Mon, 13 Jul 2020 14:51:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7FC1B20738 for ; Mon, 13 Jul 2020 14:51:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qu2t9/SU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FC1B20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C2B658D0005; Mon, 13 Jul 2020 10:51:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB4278D0001; Mon, 13 Jul 2020 10:51:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7E3D8D0005; Mon, 13 Jul 2020 10:51:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 8E2D48D0001 for ; Mon, 13 Jul 2020 10:51:05 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 37EB2824556B for ; Mon, 13 Jul 2020 14:51:05 +0000 (UTC) X-FDA: 77033340090.14.steam63_2e07d7726ee9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 0380518229835 for ; Mon, 13 Jul 2020 14:51:04 +0000 (UTC) X-HE-Tag: steam63_2e07d7726ee9 X-Filterd-Recvd-Size: 5361 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Jul 2020 14:51:04 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id g139so9220470lfd.10 for ; Mon, 13 Jul 2020 07:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xUKZlCYinai0Luu2hOdm2qnhIZ2lqYBnLnpnyrbTn3I=; b=qu2t9/SUqzkLaYFEwlQpODBK/nnlgLwz7l2VJYTrR/DC+v3zsZaCKn56tElzWPtcHn /Q0rjazMjk+yHC1rwE1i8nQL9hhJXzlcyXtEAtlmk9i3HxETJsnHiDlivYKSIbc56wK/ 8vm0kqjPm0gBZH2MdJQMaQ5byy/UHj4ypCn6Iu2V1CFGE83BYFlgkmJS557gdfQUsRz3 YCMy6tBmB+wtWOtLsa5DPlxcueem/ZeE7vP6YDeQQ//bYUkOA57A027j5wKUEAQ6LZem gCLVAA+bEN8QBxtkQksQwh1Z7ionO2BfUakJra1klkKve+16G5WCJ3i2xVXyCdXj5tKF OcBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xUKZlCYinai0Luu2hOdm2qnhIZ2lqYBnLnpnyrbTn3I=; b=iuS1+OqVo1gQgqbVmgBLmbWWzICWIaH5pudLvODiQCh3C+Ppcwm9V0TBMbh6P58BsF +HQAF5dN01xQYWxa6PwQE8otX4aSjjchG/vAb62w0g/Kpy9Zzxvc+MG7/9Kao+Wi+o1h ptGQOSb9kk0WbCq4RuCWI1dcUTZec1KUgmeUXHUHGlnCmgckZktWpu2d9IFYlAtOnc44 lA/TpzQNBcXX/H+U/iLZ/HEYa/VZb0HFa+3jgSSDYJf55D4zYBnJmxeR1BTGkcSWxySi vWUx9+1tbi8jIndT/Cid0Fyw2bnoDA3NvLIn5CtBV5KkS18lLrRCB78ED1M/7uYMXql2 20Vg== X-Gm-Message-State: AOAM531WA/NDexlltVIaGtsJg4NFtGYOcj+qgxuhFtzmjbKmNLkz8Bi/ cAiJisNYjVcfbYD/Px6/tVmiqRwcx9YJrBec8dbjzA== X-Google-Smtp-Source: ABdhPJwNsAK/CvIXssjQkfKmEI8SIz4CvARlnMPg9iz3ip4AYuZHOz+ZuUOX/MXzLaMOcYrwbWlCf5fUMZQ0vnAJXFI= X-Received: by 2002:a19:e61a:: with SMTP id d26mr47379303lfh.96.1594651862566; Mon, 13 Jul 2020 07:51:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shakeel Butt Date: Mon, 13 Jul 2020 07:50:51 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] mm, memcg: reclaim more aggressively before high allocator throttling To: Chris Down Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 0380518229835 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jul 13, 2020 at 4:42 AM Chris Down wrote: > > In Facebook production, we've seen cases where cgroups have been put > into allocator throttling even when they appear to have a lot of slack > file caches which should be trivially reclaimable. > > Looking more closely, the problem is that we only try a single cgroup > reclaim walk for each return to usermode before calculating whether or > not we should throttle. This single attempt doesn't produce enough > pressure to shrink for cgroups with a rapidly growing amount of file > caches prior to entering allocator throttling. > > As an example, we see that threads in an affected cgroup are stuck in > allocator throttling: > > # for i in $(cat cgroup.threads); do > > grep over_high "/proc/$i/stack" > > done > [<0>] mem_cgroup_handle_over_high+0x10b/0x150 > [<0>] mem_cgroup_handle_over_high+0x10b/0x150 > [<0>] mem_cgroup_handle_over_high+0x10b/0x150 > > ...however, there is no I/O pressure reported by PSI, despite a lot of > slack file pages: > > # cat memory.pressure > some avg10=78.50 avg60=84.99 avg300=84.53 total=5702440903 > full avg10=78.50 avg60=84.99 avg300=84.53 total=5702116959 > # cat io.pressure > some avg10=0.00 avg60=0.00 avg300=0.00 total=78051391 > full avg10=0.00 avg60=0.00 avg300=0.00 total=78049640 > # grep _file memory.stat > inactive_file 1370939392 > active_file 661635072 > > This patch changes the behaviour to retry reclaim either until the > current task goes below the 10ms grace period, or we are making no > reclaim progress at all. In the latter case, we enter reclaim throttling > as before. > > To a user, there's no intuitive reason for the reclaim behaviour to > differ from hitting memory.high as part of a new allocation, as opposed > to hitting memory.high because someone lowered its value. As such this > also brings an added benefit: it unifies the reclaim behaviour between > the two. > > There's precedent for this behaviour: we already do reclaim retries when > writing to memory.{high,max}, in max reclaim, and in the page allocator > itself. > > Signed-off-by: Chris Down > Cc: Andrew Morton > Cc: Johannes Weiner > Cc: Tejun Heo > Cc: Michal Hocko Reviewed-by: Shakeel Butt