Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1530252pxb; Wed, 20 Oct 2021 06:57:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/qowaMC3XNErKahj6IAxQEjfwBCjI9Uf4CtzbHbW1ZCODVALcmG+OUnNjBP/PVNMter9Y X-Received: by 2002:a17:90a:9b84:: with SMTP id g4mr7601827pjp.123.1634738266825; Wed, 20 Oct 2021 06:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634738266; cv=none; d=google.com; s=arc-20160816; b=gKVdP2DXV8mN+vZLBdlmaC0Sd50aqQZ2/K9/i5U6YguyjL/qPHxsgcwD/nN/+Pp06I yyN3hqdGymP9EuITJoXzY7Llanlgy4YXsExgRLD4ItHa1C3uKmbnofKptJnGj/yOOQHE 95pGqcZkRODcnLEZOeufYYY66Y6Q8gdVS+Q1tJDjbohIVYobsnE8Qsld4jYy74WPoPhq FN1AnxcUogfBSanmGPJCQw0Adoq5+UzMLYBw1Ieh6vwclKyYGvfWd7jh86j5msP8bTqo cnlHehUJcUh83dHfdXUEVhgs3304B3a3K/gug+PZUNapqA5NaLizt4Q6KSZEArVg31IT 8AXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SCdZv2e62ABN56MTTs5oGH5NMRs9ClTsnNTNWpGbnRI=; b=UBQsr9tDb2VrdImGAuT0dnBALcaORSMNSPgdz48sHsaHn9to++7zi8A1BObW+VMzei 7QvKAO73HbOEW/fT9YWEjI8mfHgvj7NePt9Gtn4bedvFz/6wu4lMdCs8EjViX8yTNcuz oXdbvDziuFsB/XSldM/K+Mt8ooySsW1bsD1Id8fkB3fgO1WJsyPN7h8JUZanRXoXoS35 p68Mn0z+c5JYqQsY1Cs/D6XjMxoKrgpyMCNDHyT0kwPI9JAG0ZAEemLaEC8qDzk/nsmo GhPMEAGoQZesZMthf4+iROgihZyG9WSUFWy1wlu8nRVUVJXVRN+smSpb3ud8+Ip8FAVM zc6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EWbY5Dvi; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kb13si9101955pjb.136.2021.10.20.06.57.33; Wed, 20 Oct 2021 06:57: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=@gmail.com header.s=20210112 header.b=EWbY5Dvi; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230202AbhJTN6l (ORCPT + 99 others); Wed, 20 Oct 2021 09:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbhJTN6k (ORCPT ); Wed, 20 Oct 2021 09:58:40 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2040EC06161C; Wed, 20 Oct 2021 06:56:26 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id i20so26060100edj.10; Wed, 20 Oct 2021 06:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SCdZv2e62ABN56MTTs5oGH5NMRs9ClTsnNTNWpGbnRI=; b=EWbY5Dviy2DZHiyOZzbGQdERHZ5KvL4s7Ss6sUG1m1LFp1YBswM4l3xWhZJ9KBIXSa ZbE/ZcVpj+Bu+ITXVL5JPqRYFCmU9nCrxOYYoWxLI32qSHR71pakJpYF6ecm6HpJ8S70 spltE1Vt266lFklnDyfGnTEj8Qc9UxcyrXaPDzp6R+9fYcHPoSYV3HxebnPniplf2W+F HJLBY27lOXxAM/Z129If7+XZHN0TkB5WppNubldHfisAQ2zeMTshWl8NUaqMHWlfbBF5 cPdCCdFHumG1gwhRrNh0fg6vxxpiNwxd6ZVCjff13eVd8dfT0ZYG8iuysKU1jAa5h1TZ eyNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SCdZv2e62ABN56MTTs5oGH5NMRs9ClTsnNTNWpGbnRI=; b=Wn9hQhnQtX4uCqcrwgaYsKSMF49hUwyfUcF4i2ynf840jd2z3pgb8WQmP1+u00OYYT slo/eWA1v/44lm4uur+Li9k06s+sf0WlTLNpR8JuqMLBx3WiTgPCZj0cN2YHsXfbXFcu eo0HATmUDAUhpnyL/55Ey89+qU/Pzlj0vpOxKR7QcccbI5GKhvDnkAkropLY/hsVYjrj lyc4b5cGoM2RCPbTnDc1wNebdNl2x8tTbQqBiFXTHlTiqT0G0RHOZFhZI2CzLAlzsu3M o5uCEAmGIPZznQoebPds/sS5nmybdrODEJ5LvlWWy43M/APuQl1DIazISbZy98jcsTOk UqHQ== X-Gm-Message-State: AOAM532kX86A2UFc18caMCManMtdHyXm9ObrvAT2w0Xa6Q+ocGRFZRjV Jho3SuZlSGmfV5DCoF6x/Q9xRE8fogEsFPf2j10EVdyE9u9yeA== X-Received: by 2002:a05:6402:3488:: with SMTP id v8mr218009edc.106.1634738074303; Wed, 20 Oct 2021 06:54:34 -0700 (PDT) MIME-Version: 1.0 References: <20211018114712.9802-1-mhocko@kernel.org> <20211018114712.9802-3-mhocko@kernel.org> <20211019110649.GA1933@pc638.lan> <20211019194658.GA1787@pc638.lan> In-Reply-To: From: Uladzislau Rezki Date: Wed, 20 Oct 2021 15:54:23 +0200 Message-ID: Subject: Re: [RFC 2/3] mm/vmalloc: add support for __GFP_NOFAIL To: Michal Hocko Cc: Linux Memory Management List , Dave Chinner , Neil Brown , Andrew Morton , Christoph Hellwig , linux-fsdevel@vger.kernel.org, LKML , Ilya Dryomov , Jeff Layton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > > I think adding kind of schedule() will not make things worse and in corner > > cases could prevent a power drain by CPU. It is important for mobile devices. > > I suspect you mean schedule_timeout here? Or cond_resched? I went with a > later for now, I do not have a good idea for how to long to sleep here. > I am more than happy to change to to a sleep though. > cond_resched() reschedules only if TIF_NEED_RESCHED is raised what is not good here. Because in our case we know that we definitely would like to take a breath. Therefore invoking the schedule() is more suitable here. It will give a CPU time to another waiting process(if exists) in any case putting the "current" one to the tail. As for adding a delay. I am not sure about for how long to delay or i would say i do not see a good explanation why for example we delay for 10 milliseconds or so. > > As for vmap space, it can be that a user specifies a short range that does > > not contain any free area. In that case we might never return back to a caller. > > This is to be expected. The caller cannot fail and if it would be > looping around vmalloc it wouldn't return anyway. > > > Maybe add a good comment something like: think what you do when deal with the > > __vmalloc_node_range() and __GFP_NOFAIL? > > We have a generic documentation for gfp flags and __GFP_NOFAIL is > docuemented to "The allocation could block indefinitely but will never > return with failure." We are discussing improvements for the generic > documentation in another thread [1] and we will likely extend it so I > suspect we do not have to repeat drawbacks here again. > > [1] http://lkml.kernel.org/r/163184741778.29351.16920832234899124642.stgit@noble.brown > > Anyway the gfp mask description and constrains for vmalloc are not > documented. I will add a new patch to fill that gap and send it as a > reply to this one > This is really good. People should be prepared for a case when it never returns back to a caller :) -- Uladzislau Rezki