Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1655036pxb; Tue, 26 Oct 2021 13:08:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn2xAkL/WKzNJ9rsLXmUGw097wLQlfbWfZKdIl8SKWqaJwsrXtGbla2W3KZOQgiRUS9aFu X-Received: by 2002:a05:6402:1436:: with SMTP id c22mr38407266edx.153.1635278926717; Tue, 26 Oct 2021 13:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635278926; cv=none; d=google.com; s=arc-20160816; b=HidWd0odB+Fo2WpfgcJu5M4VX3y8lzMbH/XvsfDOUNayjWTGA5bEel8v9/IFnJWLy+ RZOxBbDhGnJ/naZ46m5v3Rd1iR1WWzNf/RdkYRKHdHyetY7rh9SohbmrgYt3pLfnBpY7 9Wvf8cllPmybqLMqz60k+31CsozYzNP1oKD5a7OzPygJW98A3nq4IPBwhrQZ7NcILSlX SsZ2Ago3FCMGJxkVZYfvNmmXQGeEdgauYKDN5/nBn3KSmwIJia41+FM/q6RGdQRdz1qB nYVdC+uaBvvd/i6TEylXweHdGGw1JeODroUlCAjCFkV9HPFmRZuqkZYwOKXA0XSTv6R9 pGSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4ePQT19X3SmPjH11bt5aB3Nm5hoxOx1Fk0Lqohn1Wk8=; b=MTxaDApqE1N0ggURvtWUxrcr0sndNfTv6eiQynsV4TQM0OGN7SYatzbACQwVcKs0cl QQXKP5z5GcNp4BX1hnP3CZqWjObiD2kVYp1XCxtGPuYAOE8NDv8Fdu02skBE1bWvnugE xQm5Hcejov26w1XPWvNgWGuY4Hbl1QlRoStjeZjgieY3VKMQUQrx7r5vZFPxSdjFR6UU +wmLbcnO8Khg2e1hN4QCva+sb2gc7fs9lqfUWv4CJPmRFkyCqoATSZkdcZYs/QmO2Bqr NdoLCkTUaiTEKbrPSFpLOOTvhCMorf/rPELLIVED8SfCVs0PDSlOoIzmco8fy7PF/W9l ksPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="PAi/DyGK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg41si8792165ejc.44.2021.10.26.13.07.53; Tue, 26 Oct 2021 13:08:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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.com header.s=susede1 header.b="PAi/DyGK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235954AbhJZOqR (ORCPT + 99 others); Tue, 26 Oct 2021 10:46:17 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:37952 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236928AbhJZOqN (ORCPT ); Tue, 26 Oct 2021 10:46:13 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5529A1FCA3; Tue, 26 Oct 2021 14:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635259428; 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=4ePQT19X3SmPjH11bt5aB3Nm5hoxOx1Fk0Lqohn1Wk8=; b=PAi/DyGKz1Mz5H4MHeeXD6ynrnsFc7G/5X2HKstjEcdLp7rpHF3nvMFruGh09Lgvw9OCqH yyE93pclYHHJPiTwHjPe1Mltuzw3nDYYu2R6+IfYCXUql9d2ga5dHGsEZF1JJWAxYASvvf 3UvMvc/CrR7r3Tmju3MhwaGBzU7sc7A= 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 2819EA3BA0; Tue, 26 Oct 2021 14:43:48 +0000 (UTC) Date: Tue, 26 Oct 2021 16:43:47 +0200 From: Michal Hocko To: Uladzislau Rezki Cc: NeilBrown , Linux Memory Management List , Dave Chinner , Andrew Morton , Christoph Hellwig , linux-fsdevel@vger.kernel.org, LKML , Ilya Dryomov , Jeff Layton Subject: Re: [RFC 2/3] mm/vmalloc: add support for __GFP_NOFAIL Message-ID: References: <20211020192430.GA1861@pc638.lan> <163481121586.17149.4002493290882319236@noble.neil.brown.name> <20211021104038.GA1932@pc638.lan> <163485654850.17149.3604437537345538737@noble.neil.brown.name> <20211025094841.GA1945@pc638.lan> <163520582122.16092.9250045450947778926@noble.neil.brown.name> <163524388152.8576.15706993879941541847@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 26-10-21 16:25:07, Uladzislau Rezki wrote: > On Tue, Oct 26, 2021 at 12:24 PM NeilBrown wrote: > > > > On Tue, 26 Oct 2021, Michal Hocko wrote: > > > On Tue 26-10-21 10:50:21, Neil Brown wrote: > > > > On Mon, 25 Oct 2021, Uladzislau Rezki wrote: > > > > > On Fri, Oct 22, 2021 at 09:49:08AM +1100, NeilBrown wrote: > > > > > > However I'm not 100% certain, and the behaviour might change in the > > > > > > future. So having one place (the definition of memalloc_retry_wait()) > > > > > > where we can change the sleeping behaviour if the alloc_page behavour > > > > > > changes, would be ideal. Maybe memalloc_retry_wait() could take a > > > > > > gfpflags arg. > > > > > > > > > > > At sleeping is required for __get_vm_area_node() because in case of lack > > > > > of vmap space it will end up in tight loop without sleeping what is > > > > > really bad. > > > > > > > > > So vmalloc() has two failure modes. alloc_page() failure and > > > > __alloc_vmap_area() failure. The caller cannot tell which... > > > > > > > > Actually, they can. If we pass __GFP_NOFAIL to vmalloc(), and it fails, > > > > then it must have been __alloc_vmap_area() which failed. > > > > What do we do in that case? > > > > Can we add a waitq which gets a wakeup when __purge_vmap_area_lazy() > > > > finishes? > > > > If we use the spinlock from that waitq in place of free_vmap_area_lock, > > > > then the wakeup would be nearly free if no-one was waiting, and worth > > > > while if someone was waiting. > > > > > > Is this really required to be part of the initial support? > > > > No.... I was just thinking out-loud. > > > alloc_vmap_area() has an retry path, basically if it fails the code > will try to "purge" > areas and repeat it one more time. So we do not need to purge outside some where > else. I think that Neil was not concerned about the need for purging something but rather a waiting event the retry loop could hook into. So that the sleep wouldn't have to be a random timeout but something that is actually actionable - like somebody freeing an area. -- Michal Hocko SUSE Labs