Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp872244pxb; Wed, 15 Sep 2021 15:37:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/enXXijhLxGQD3d0luUEANP2bdKTNj1KOJ0DOr7qXfjjALJ1O1sZInBicCMbC3cKuH646 X-Received: by 2002:a17:906:2bdb:: with SMTP id n27mr2703873ejg.86.1631745427926; Wed, 15 Sep 2021 15:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631745427; cv=none; d=google.com; s=arc-20160816; b=oKyWOl6cNazQD3CHes3/tZdNqjgbUxOreM4ybEyPqGbc7vfzDckD5ckDEdxm6ckelk bUXk/Y5KbMzghvbjFFHAO1G3irLkgC7g8m/4X3/cC4v+qIjn1p7eHBSouoAQq1GbGXJX A3dnTMbyqhC6+LT4o/vMogkUGQCO8xikcqDgiEAIFA4+sdb+aFpB3O1lMbjBqqsUHZ3c g0F6qqqjToVvWN+yU7Qdfc64EXYc4jV2Kl28igxvDbsZMCOmqhOnNc3bsh0LEk1tHM3N vBWozXOnbS9hnzT8zQoeMMOyyeG5U05/HCAjaHWFL1OdtEwliHS3hVfB01lxswvcKlUZ yWPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=JgZsYMmsqoTtaIffqm+LgUI61DrT1bvGtpHuAgBAgHg=; b=bTVWHEYB1M0y4Lu4okCfDSJKVQ1pfd+pqpJErcS5pioAX79UoftkI2UDjaISwvzL4I oZcJGhznjvZP04ybj6yj9Xtr++XsseXUTK6JFv3nu++Q6WxpkA7Ezmn2Q51GBDoHtxV/ LNAy+OFmSnHsg+qHX7PPz90DIe91PAPiwgnjars2CSQfs8HFRptL6z2Wi2B57qAn7AdB 6JLpugXP5mPabrTmbcUby4/i6zwt4CU06VYFAUQNrOLXAtaap1jMnU93zQQpxmJWFAfH tYIUJ/rqLxXMQ7hdZmpUfA3RlmqDjmlFlF4O7y5RdlOqeZz4SmiwHjQX1lbtKbhhiYhI 29ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=shB4rBHW; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j4si1463099ejo.225.2021.09.15.15.36.33; Wed, 15 Sep 2021 15:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=shB4rBHW; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbhIOWhO (ORCPT + 99 others); Wed, 15 Sep 2021 18:37:14 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:38310 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbhIOWhK (ORCPT ); Wed, 15 Sep 2021 18:37:10 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 53ED322323; Wed, 15 Sep 2021 22:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1631745347; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JgZsYMmsqoTtaIffqm+LgUI61DrT1bvGtpHuAgBAgHg=; b=shB4rBHWjsQzJSjuYNvpz+qx09iQlmlzyUlYQG4mK0I8Oq0LoBQdBjz5SC8d9rCNaSEQC3 z4cnLF7vLZbCLfS68MgEbMX/JiWYAabou3SUCIzfEg4sL7Lz4hjdMOCz9731kDaPCwaLLA FtnGEE57fq/siqOWE3m9PSg3ovkUvWE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1631745347; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JgZsYMmsqoTtaIffqm+LgUI61DrT1bvGtpHuAgBAgHg=; b=s5BHawe8Yvvo9IzI+WIYfpeIDNcwBKcloNxJGfnJCVoVXQp+rZk0It2270SDw/l+t64odJ tR44mjA4Vwlf7zAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 65EF613C77; Wed, 15 Sep 2021 22:35:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0QavCT91QmFWUgAAMHmgww (envelope-from ); Wed, 15 Sep 2021 22:35:43 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Michal Hocko" Cc: "Mel Gorman" , "Andrew Morton" , "Theodore Ts'o" , "Andreas Dilger" , "Darrick J. Wong" , "Jan Kara" , "Matthew Wilcox" , linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/6] EXT4: Remove ENOMEM/congestion_wait() loops. In-reply-to: References: <163157808321.13293.486682642188075090.stgit@noble.brown>, <163157838437.13293.14244628630141187199.stgit@noble.brown>, <20210914163432.GR3828@suse.com>, <163165609100.3992.1570739756456048657@noble.neil.brown.name>, Date: Thu, 16 Sep 2021 08:35:40 +1000 Message-id: <163174534006.3992.15394603624652359629@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, 15 Sep 2021, Michal Hocko wrote: > On Wed 15-09-21 07:48:11, Neil Brown wrote: > >=20 > > Why does __GFP_NOFAIL access the reserves? Why not require that the > > relevant "Try harder" flag (__GFP_ATOMIC or __GFP_MEMALLOC) be included > > with __GFP_NOFAIL if that is justified? >=20 > Does 5020e285856c ("mm, oom: give __GFP_NOFAIL allocations access to > memory reserves") help? Yes, that helps. A bit. I'm not fond of the clause "the allocation request might have come with some locks held". What if it doesn't? Does it still have to pay the price. Should we not require that the caller indicate if any locks are held? That way callers which don't hold locks can use __GFP_NOFAIL without worrying about imposing on other code. Or is it so rare that __GFP_NOFAIL would be used without holding a lock that it doesn't matter? The other commit of interest is Commit: 6c18ba7a1899 ("mm: help __GFP_NOFAIL allocations which do not trigger= OOM killer") I don't find the reasoning convincing. It is a bit like "Robbing Peter to pay Paul". It takes from the reserves to allow a __GFP_NOFAIL to proceed, with out any reason to think this particular allocation has any more 'right' to the reserves than anything else. While I don't like the reasoning in either of these, they do make it clear (to me) that the use of reserves is entirely an internal policy decision. They should *not* be seen as part of the API and callers should not have to be concerned about it when deciding whether to use __GFP_NOFAIL or not. The use of these reserves is, at most, a hypothetical problem. If it ever looks like becoming a real practical problem, it needs to be fixed internally to the page allocator. Maybe an extra water-mark which isn't quite as permissive as ALLOC_HIGH... I'm inclined to drop all references to reserves from the documentation for __GFP_NOFAIL. I think there are enough users already that adding a couple more isn't going to make problems substantially more likely. And more will be added anyway that the mm/ team won't have the opportunity or bandwidth to review. Meanwhile I'll see if I can understand the intricacies of alloc_page so that I can contibute to making it more predictable. Question: In those cases where an open-coded loop is appropriate, such as when you want to handle signals or can drop locks, how bad would it be to have a tight loop without any sleep? should_reclaim_retry() will sleep 100ms (sometimes...). Is that enough? __GFP_NOFAIL doesn't add any sleep when looping. Thanks, NeilBrown