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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE05C433EF for ; Mon, 25 Oct 2021 09:48:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6107C60C41 for ; Mon, 25 Oct 2021 09:48:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6107C60C41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E712D6B0073; Mon, 25 Oct 2021 05:48:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E20FD6B0074; Mon, 25 Oct 2021 05:48:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC267940007; Mon, 25 Oct 2021 05:48:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id BA8226B0073 for ; Mon, 25 Oct 2021 05:48:45 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7CEF918094F56 for ; Mon, 25 Oct 2021 09:48:45 +0000 (UTC) X-FDA: 78734485410.09.85C44B5 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by imf01.hostedemail.com (Postfix) with ESMTP id A12165084D66 for ; Mon, 25 Oct 2021 09:48:38 +0000 (UTC) Received: by mail-lf1-f53.google.com with SMTP id g36so10637806lfv.3 for ; Mon, 25 Oct 2021 02:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QqMsyiItk1CJUMLvyAB7oSGHiADomdsKstyP5G3/bD4=; b=BQBx13oTsSRi0WotZ6RouoyPwz+KDAthgNX+I1SY+ZScstqpndlFGw/fDOiQxcmMJI aly2HJXmdYLUQEBIbwABDStH7F9eYP0XsfAJ7bvZ3GiECTjhHZw6Cygc3ppgmgblANRA E1M0/nT3FM+1QPJpXKI5DZYgUSNECm/aX+7YyWabbG+Fg6imXbE8TklInmq/a5+kfTlY uJqijtaxyaphvlZAdfAd1iijZbulcM0tOBu+MZmm0KQ2lIO6as06SGmPtgTxy03bUGF1 330STbtZDXl14qZrXt9xzN3y0EzRxHg5KwGAqqjHJ2ZDg/vV0Bwk/qwsr08fVGrl1gRn YdQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QqMsyiItk1CJUMLvyAB7oSGHiADomdsKstyP5G3/bD4=; b=MDp1xSYOxz4600yGF/Q5X/zqDRocSK1U5R5P/tOGzQnTZTkQ+TuZzazzhXe8wHECsd ZwncZshMJy7ZfNgS4JtNx4U4rgo+xkiexXRsbR6jo1vr/TrBbAdwHG+qnQxeSvxl2BLT sQLWJ6tzsVk3vrTeHLv5BsWmuDDiaE7tprMHSVLfITxu655Iz/60DFPxlYOQ9YF0ExUq ukQntcKIX8m1BMp1XLRNTwUpgCia1hk4kcxX5KZM42VAfH8tw5FnXfAPnC+Zg2Ijhg5j Bz0VqseUqDDgpgwldXbARXbS4gl81mEQbYtJte+qp2gpnIS2EIR85wKiMWXum31C70By PDug== X-Gm-Message-State: AOAM530+R+F/jWi21UsOOUsMGZqf8pIaijcE1PH3q/bRG3ceavLtTgGR My167A00B1rjl92lS5gxttw= X-Google-Smtp-Source: ABdhPJxdegWrzpwWbMEBfHHyQe0pC8DZVIbVEnnaJD0GfN2N62Z6nPDzF8N35T6dFYy6LNaQZWAHtQ== X-Received: by 2002:ac2:4c56:: with SMTP id o22mr15995166lfk.196.1635155323376; Mon, 25 Oct 2021 02:48:43 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id b29sm323084lfv.160.2021.10.25.02.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 02:48:42 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 25 Oct 2021 11:48:41 +0200 To: NeilBrown , Michal Hocko Cc: Uladzislau Rezki , Michal Hocko , 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: <20211025094841.GA1945@pc638.lan> References: <20211020192430.GA1861@pc638.lan> <163481121586.17149.4002493290882319236@noble.neil.brown.name> <20211021104038.GA1932@pc638.lan> <163485654850.17149.3604437537345538737@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <163485654850.17149.3604437537345538737@noble.neil.brown.name> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: A12165084D66 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BQBx13oT; spf=pass (imf01.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.53 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: 4btcespj4qjpphmde7dappn358xmy5rg X-Rspamd-Server: rspam06 X-HE-Tag: 1635155318-717471 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 Fri, Oct 22, 2021 at 09:49:08AM +1100, NeilBrown wrote: > On Thu, 21 Oct 2021, Uladzislau Rezki wrote: > > > On Thu 21-10-21 21:13:35, Neil Brown wrote: > > > > On Thu, 21 Oct 2021, Uladzislau Rezki wrote: > > > > > On Wed, Oct 20, 2021 at 05:00:28PM +0200, Uladzislau Rezki wrote: > > > > > > > > > > > > > > On Wed 20-10-21 16:29:14, Uladzislau Rezki wrote: > > > > > > > > On Wed, Oct 20, 2021 at 4:06 PM Michal Hocko wrote: > > > > > > > [...] > > > > > > > > > As I've said I am OK with either of the two. Do you or anybody have any > > > > > > > > > preference? Without any explicit event to wake up for neither of the two > > > > > > > > > is more than just an optimistic retry. > > > > > > > > > > > > > > > > > From power perspective it is better to have a delay, so i tend to say > > > > > > > > that delay is better. > > > > > > > > > > > > > > I am a terrible random number generator. Can you give me a number > > > > > > > please? > > > > > > > > > > > > > Well, we can start from one jiffy so it is one timer tick: schedule_timeout(1) > > > > > > > > > > > A small nit, it is better to replace it by the simple msleep() call: msleep(jiffies_to_msecs(1)); > > > > > > > > I disagree. I think schedule_timeout_uninterruptible(1) is the best > > > > wait to sleep for 1 ticl > > > > > > > > msleep() contains > > > > timeout = msecs_to_jiffies(msecs) + 1; > > > > and both jiffies_to_msecs and msecs_to_jiffies might round up too. > > > > So you will sleep for at least twice as long as you asked for, possible > > > > more. > > > > > > That was my thinking as well. Not to mention jiffies_to_msecs just to do > > > msecs_to_jiffies right after which seems like a pointless wasting of > > > cpu cycle. But maybe I was missing some other reasons why msleep would > > > be superior. > > > > > > > To me the msleep is just more simpler from semantic point of view, i.e. > > it is as straight forward as it can be. In case of interruptable/uninteraptable > > sleep it can be more confusing for people. > > I agree that msleep() is more simple. I think adding the > jiffies_to_msec() substantially reduces that simplicity. > > > > > When it comes to rounding and possibility to sleep more than 1 tick, it > > really does not matter here, we do not need to guarantee exact sleeping > > time. > > > > Therefore i proposed to switch to the msleep(). > > If, as you say, the precision doesn't matter that much, then maybe > msleep(0) > which would sleep to the start of the next jiffy. Does that look a bit > weird? If so, the msleep(1) would be ok. > Agree, msleep(1) looks much better rather then converting 1 jiffy to milliseconds. Result should be the same. > However now that I've thought about some more, I'd much prefer we > introduce something like > memalloc_retry_wait(); > > and use that everywhere that a memory allocation is retried. > I'm not convinced that we need to wait at all - at least, not when > __GFP_DIRECT_RECLAIM is used, as in that case alloc_page will either > - succeed > - make some progress a reclaiming or > - sleep > > 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. Thanks! -- Vlad Rezki