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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A817C433EF for ; Thu, 2 Dec 2021 17:41:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10C476B0072; Thu, 2 Dec 2021 12:41:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 094526B0074; Thu, 2 Dec 2021 12:41:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4FC86B0075; Thu, 2 Dec 2021 12:41:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id CF6F06B0072 for ; Thu, 2 Dec 2021 12:41:27 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 925588249980 for ; Thu, 2 Dec 2021 17:41:17 +0000 (UTC) X-FDA: 78873570594.18.0BCCD9E Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by imf05.hostedemail.com (Postfix) with ESMTP id 17B45100002 for ; Thu, 2 Dec 2021 17:41:16 +0000 (UTC) Received: by mail-lj1-f179.google.com with SMTP id 13so1103880ljj.11 for ; Thu, 02 Dec 2021 09:41:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Sel9QLaZVY4N+mTLlgeCKeQqHTygfT86F1uxh//ubJk=; b=HBLmPCV+9oCwHZNYcNxG43IdBP8nmESwXT5WI7ZvozEylY0SxYxbx3yvK8hRsnW9oX WCoHepnTCI6wZD6uClG5zlGVdL7PxfteS4avkFUtE47j4XEgz3TYQFKsSSBSVcW+sLe8 TmPjrny5x9F6q2IbjeZXHzOnzz9jkjPuJkxA82whsbyBV4KhQW8cqDzgXVHqwhzz9iCE +/kGoTXMYMk/O/awyc60UzDdOMAeDrs6VEVaJyM7+JFUDco7xMUBt+7c7A51doDv2Irj sJQdPmtP7ubIW3L4+bSqS39T+DSuoGJvo3b4ZV4ZdbdScOj+bycogtO4gFABWdDW9rky xO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Sel9QLaZVY4N+mTLlgeCKeQqHTygfT86F1uxh//ubJk=; b=vGOp4AfqlezWZQN+OgYAZx3ofqI+fgmBtT1LiELqLx84nXcr6i/4vZfQXYoepXYA1L zlklmCwMCVScJsw8MGxims1aU+Wzlld/gt3LHVIWeivX1hbPadfgKXjsHOQpOU+QSz8u Ovi5O76c+34XUUOIyP3c9j0HW9RDFDAvwscJ/wZVLYJsjtNx3G1N1JG25F/STfT0jgaF KhUAGcTWmWZxLV+VYI8bgDI6snMs2queqX5O1tkXe6SUWqupZ/lfUBIxSheT+ik1HlZf BbVVtDU2y/3zZ5sWTNlJsuz6rkp/FdJqUz12rIQK2FL3Wojd9KmSZRj65d1Scs8HM9Bb /a7w== X-Gm-Message-State: AOAM531RYzbspjAJnj8tc7JTdfBTIeRnUzzYHsSAhuwzODUOzjVEz0RY l5Bz+5B3K6mqWZ5hm3K0Z4NsPsg/8+6Fipsoc2JIQA== X-Google-Smtp-Source: ABdhPJxwsHniTL8HtWjxo0S47SHXwpQxqVedZCKIvQGSboEzg0cQOFPO30fWETeZK9KDiV3DDDoW9A9k9CWWDfdOAVQ= X-Received: by 2002:a05:651c:545:: with SMTP id q5mr12693560ljp.202.1638466875265; Thu, 02 Dec 2021 09:41:15 -0800 (PST) MIME-Version: 1.0 References: <20211202150614.22440-1-mgorman@techsingularity.net> <20211202165220.GZ3366@techsingularity.net> In-Reply-To: <20211202165220.GZ3366@techsingularity.net> From: Shakeel Butt Date: Thu, 2 Dec 2021 09:41:04 -0800 Message-ID: Subject: Re: [PATCH v4 1/1] mm: vmscan: Reduce throttling due to a failure to make progress To: Mel Gorman Cc: Andrew Morton , Michal Hocko , Vlastimil Babka , Alexey Avramov , Rik van Riel , Mike Galbraith , Darrick Wong , regressions@lists.linux.dev, Linux-fsdevel , Linux-MM , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 17B45100002 X-Stat-Signature: xb88nz33rd6hbrfghqswpmfsd1pz6xui Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=HBLmPCV+; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of shakeelb@google.com designates 209.85.208.179 as permitted sender) smtp.mailfrom=shakeelb@google.com X-Rspamd-Server: rspam02 X-HE-Tag: 1638466876-617902 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: On Thu, Dec 2, 2021 at 8:52 AM Mel Gorman wrote: > > On Thu, Dec 02, 2021 at 08:30:51AM -0800, Shakeel Butt wrote: > > Hi Mel, > > > > On Thu, Dec 2, 2021 at 7:07 AM Mel Gorman wrote: > > > > > > Mike Galbraith, Alexey Avramov and Darrick Wong all reported similar > > > problems due to reclaim throttling for excessive lengths of time. > > > In Alexey's case, a memory hog that should go OOM quickly stalls for > > > several minutes before stalling. In Mike and Darrick's cases, a small > > > memcg environment stalled excessively even though the system had enough > > > memory overall. > > > > > > Commit 69392a403f49 ("mm/vmscan: throttle reclaim when no progress is being > > > made") introduced the problem although commit a19594ca4a8b ("mm/vmscan: > > > increase the timeout if page reclaim is not making progress") made it > > > worse. Systems at or near an OOM state that cannot be recovered must > > > reach OOM quickly and memcg should kill tasks if a memcg is near OOM. > > > > > > > Is there a reason we can't simply revert 69392a403f49 instead of adding > > more code/heuristics? Looking more into 69392a403f49, I don't think the > > code and commit message are in sync. > > > > For the memcg reclaim, instead of just removing congestion_wait or > > replacing it with schedule_timeout in mem_cgroup_force_empty(), why > > change the behavior of all memcg reclaim. Also this patch effectively > > reverts that behavior of 69392a403f49. > > > > It doesn't fully revert it but I did consider reverting it. The reason > why I preserved it because the intent originally was to throttle somewhat > when progress is not being made to avoid a premature OOM and I wanted to > preserve that charactersistic. Right now, this is the least harmful way > of doing it. If I understand correctly, the original intent of 69392a403f49 which you want to preserve is "avoid premature OOMs when reclaim is not making progress". Were there any complaints or bug reports on these premature OOMs? > > As more memcg, I removed the NOTHROTTLE because the primary reason why a > memcg might fail to make progress is excessive writeback and that should > still throttle. Completely failing to make progress in a memcg is most > likely due to a memcg-OOM. > > > For direct reclaimers under global pressure, why is page allocator a bad > > place for stalling on no progress reclaim? IMHO the callers of the > > reclaim should decide what to do if reclaim is not making progress. > > Because it's a layering violation and the caller has little direct control > over the reclaim retry logic. The page allocator has no visibility on > why reclaim failed only that it did fail. > Isn't it better that the reclaim returns why it is failing instead of littering the reclaim code with 'is this global reclaim', 'is this memcg reclaim', 'am I kswapd' which is also a layering violation. IMO this is the direction we should be going towards though not asking to do this now. Regarding this patch and 69392a403f49, I am still confused on the main motivation behind 69392a403f49 to change the behavior of 'direct reclaimers from page allocator'. thanks, Shakeel