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 98E2AC433F5 for ; Thu, 25 Nov 2021 08:48:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DB756B0074; Thu, 25 Nov 2021 03:48:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 23DDC6B0075; Thu, 25 Nov 2021 03:48:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 105AD6B007B; Thu, 25 Nov 2021 03:48:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0111.hostedemail.com [216.40.44.111]) by kanga.kvack.org (Postfix) with ESMTP id EEBB66B0074 for ; Thu, 25 Nov 2021 03:48:36 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B25958E2D4 for ; Thu, 25 Nov 2021 08:48:26 +0000 (UTC) X-FDA: 78846826212.15.599C700 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf07.hostedemail.com (Postfix) with ESMTP id CD1DE10002CF for ; Thu, 25 Nov 2021 08:48:22 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3351B1FDF1; Thu, 25 Nov 2021 08:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1637830105; 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=pt2wQc0xO3+L+HqTW/ikNMf2yZMXx2NWK0BLx8/Tk8Q=; b=EZsHuzNvTqeG4VQrXHgDWx2jaWEGS3QfVg+PA9U96b3kUKKrLPMzOKZ7ijT6V5e718J0qd EZz5EM4GzBgoWY1TMVefvKorbJ6kXB1tMSDISnDs3/wF42zZ4ZkaUKGfqGwQ9Ue6o30k4c Xcu43g16FW47fkrY0vxo7Ajau8CQGJk= 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 ED5A8A3B81; Thu, 25 Nov 2021 08:48:24 +0000 (UTC) Date: Thu, 25 Nov 2021 09:48:24 +0100 From: Michal Hocko To: Uladzislau Rezki Cc: Andrew Morton , Dave Chinner , Neil Brown , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, LKML , Ilya Dryomov , Jeff Layton Subject: Re: [PATCH v2 2/4] mm/vmalloc: add support for __GFP_NOFAIL Message-ID: References: <20211122153233.9924-1-mhocko@kernel.org> <20211122153233.9924-3-mhocko@kernel.org> <20211123170238.f0f780ddb800f1316397f97c@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: CD1DE10002CF X-Stat-Signature: r3po7uy5s45aeyw8i375f841wxbacxwi Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=EZsHuzNv; spf=pass (imf07.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-HE-Tag: 1637830102-802980 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 Wed 24-11-21 21:37:54, Uladzislau Rezki wrote: > On Wed, Nov 24, 2021 at 09:43:12AM +0100, Michal Hocko wrote: > > On Tue 23-11-21 17:02:38, Andrew Morton wrote: > > > On Tue, 23 Nov 2021 20:01:50 +0100 Uladzislau Rezki wrote: > > > > > > > On Mon, Nov 22, 2021 at 04:32:31PM +0100, Michal Hocko wrote: > > > > > From: Michal Hocko > > > > > > > > > > Dave Chinner has mentioned that some of the xfs code would benefit from > > > > > kvmalloc support for __GFP_NOFAIL because they have allocations that > > > > > cannot fail and they do not fit into a single page. > > > > > > Perhaps we should tell xfs "no, do it internally". Because this is a > > > rather nasty-looking thing - do we want to encourage other callsites to > > > start using it? > > > > This is what xfs is likely going to do if we do not provide the > > functionality. I just do not see why that would be a better outcome > > though. My longterm experience tells me that whenever we ignore > > requirements by other subsystems then those requirements materialize in > > some form in the end. In many cases done either suboptimaly or outright > > wrong. This might be not the case for xfs as the quality of > > implementation is high there but this is not the case in general. > > > > Even if people start using vmalloc(GFP_NOFAIL) out of lazyness or for > > any other stupid reason then what? Is that something we should worry > > about? Retrying within the allocator doesn't make the things worse. In > > fact it is just easier to find such abusers by grep which would be more > > elaborate with custom retry loops. > > > > [...] > > > > > + if (nofail) { > > > > > + schedule_timeout_uninterruptible(1); > > > > > + goto again; > > > > > + } > > > > > > The idea behind congestion_wait() is to prevent us from having to > > > hard-wire delays like this. congestion_wait(1) would sleep for up to > > > one millisecond, but will return earlier if reclaim events happened > > > which make it likely that the caller can now proceed with the > > > allocation event, successfully. > > > > > > However it turns out that congestion_wait() was quietly broken at the > > > block level some time ago. We could perhaps resurrect the concept at > > > another level - say by releasing congestion_wait() callers if an amount > > > of memory newly becomes allocatable. This obviously asks for inclusion > > > of zone/node/etc info from the congestion_wait() caller. But that's > > > just an optimization - if the newly-available memory isn't useful to > > > the congestion_wait() caller, they just fail the allocation attempts > > > and wait again. > > > > vmalloc has two potential failure modes. Depleted memory and vmalloc > > space. So there are two different events to wait for. I do agree that > > schedule_timeout_uninterruptible is both ugly and very simple but do we > > really need a much more sophisticated solution at this stage? > > > I would say there is at least one more. It is about when users set their > own range(start:end) where to allocate. In that scenario we might never > return to a user, because there might not be any free vmap space on > specified range. > > To address this, we can allow __GFP_NOFAIL only for entire vmalloc > address space, i.e. within VMALLOC_START:VMALLOC_END. How should we do that? -- Michal Hocko SUSE Labs