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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 E2FC8C4338F for ; Thu, 19 Aug 2021 14:16:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8527E61056 for ; Thu, 19 Aug 2021 14:16:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8527E61056 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0D8946B006C; Thu, 19 Aug 2021 10:16:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 088D06B0071; Thu, 19 Aug 2021 10:16:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB91F8D0001; Thu, 19 Aug 2021 10:16:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id D07576B006C for ; Thu, 19 Aug 2021 10:16:07 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7D03D180CCF68 for ; Thu, 19 Aug 2021 14:16:07 +0000 (UTC) X-FDA: 78492029574.35.FCDD706 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf16.hostedemail.com (Postfix) with ESMTP id 17692F005DBE for ; Thu, 19 Aug 2021 14:16:06 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A3A28220BE; Thu, 19 Aug 2021 14:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1629382565; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q+liZyf0gQBDeEjMs5xiS5qrRbKrAdkXf2nxUHMb1o0=; b=GUaZFaitBhjNCNJRai2GDo1/NfoUd5SY33Zqy90P9CEKB8JcW4E3sT2DQfIXk+kMCUG2TF BW+ajnZIiVZXntoJIdkasM1y1euCssWiO2O9edFnj0eEBQ4QVLYJhDbK/PdldgkBtJWwcu JFOhpHAAfL/W8too8lzfzM1lyDKz8Mg= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A55C7A42F2; Thu, 19 Aug 2021 14:16:04 +0000 (UTC) Date: Thu, 19 Aug 2021 16:16:03 +0200 From: Michal Hocko To: Chris Down Cc: Vlastimil Babka , Kefeng Wang , linux-mm@kvack.org, Andrew Morton , Muchun Song , Matthew Wilcox , Chunxin Zang Subject: Re: [PATCH] mm, vmscan: guarantee drop_slab_node() termination Message-ID: References: <20210818152239.25502-1-vbabka@suse.cz> <47437115-1a84-c1d1-d91e-1d23cf7f4a5d@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=GUaZFait; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf16.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: 3j4kt5j6wy6dogb1ggqboa1ctgitspc9 X-Rspamd-Queue-Id: 17692F005DBE X-Rspamd-Server: rspam01 X-HE-Tag: 1629382566-454995 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 19-08-21 14:21:08, Chris Down wrote: > Vlastimil Babka writes: > > On 8/19/21 4:55 AM, Kefeng Wang wrote: > > > > > > On 2021/8/19 5:48, Chris Down wrote: > > > > Vlastimil Babka writes: > > > > > > > > I think this is a good idea, thanks for bringing it up :-) > > > > > > > > I'm not sure about the bitshift idea, though. It certainly makes sure > > > > that even large, continuous periods of reclaim eventually terminates, > > > > but I find it hard to reason about -- for example, if there's a lot of > > > > parallel activity, that might result in 10 constantly reintroduced > > > > pages, or 1000 pages, and it's not immediately obvious that we should > > > > treat those differently. > > > > > > > > What about using MAX_RECLAIM_RETRIES? There's already precedent for > > > > using it in non-OOM scenarios, like mem_cgroup_handle_over_high. > > > > It's an option, but then (together with fixed threshold) it ignores how > > large the 'freed' value is, as long it's above threshold? Although the > > end result will probably not be much different. > > Yeah, but we already draw the line at 10 right now. `freed > 10 && retries < > MAX_RECLAIM_RETRIES` seems easier to reason about, at least to me, and stays > closer to the current behaviour while providing a definitive point of loop > termination. I have to say that I am not really a fan of MAX_RECLAIM_RETRIES approach especially for user interfaces. Any limit on retries has kicked us back (e.g. offlining for the memory hotplug just to mention one of those). drop_caches can take a long time on its own even without retrying. We should teach people to interrupt those operations if they should really finish early (e.g. timeout $TIMEOUT echo > /proc/sys/vm/drop_caches) rather than trying to be extra clever here. I am not against the patch Vlastimil is proposing because it replaces an ad-hoc limit on the reclaimed objects threshold with something that is less "random" - sort of a backoff instead seems like an improvement to me. But I would still be worried that this could regress for some users so in an ideal world the existing bail on signal should be enough. -- Michal Hocko SUSE Labs