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 X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEF15C433B4 for ; Sun, 9 May 2021 21:26:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3A237610A7 for ; Sun, 9 May 2021 21:26:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A237610A7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4717B6B0070; Sun, 9 May 2021 17:26:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 421F16B0071; Sun, 9 May 2021 17:26:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29B186B0072; Sun, 9 May 2021 17:26:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 0C1A56B0070 for ; Sun, 9 May 2021 17:26:46 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BA756181AF5C3 for ; Sun, 9 May 2021 21:26:45 +0000 (UTC) X-FDA: 78122977170.22.C28B3B5 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by imf26.hostedemail.com (Postfix) with ESMTP id 2AC7A40002F0 for ; Sun, 9 May 2021 21:26:32 +0000 (UTC) Received: by mail-lf1-f48.google.com with SMTP id t11so20353105lfl.11 for ; Sun, 09 May 2021 14:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XnuIGDHz+vWuMXJWxtX9N5UENBs226CX5hzP3bDj+NE=; b=YtCpBUB7I9innRiRVY6qqANz4wGuCSq3nS1d16rPHtz7iPxjzWbk76l4mllNaivafB SBNlBiWz98s2pMCqOBCDO9U0Jr/MidaotwWuafuu20L7ywZSrx9dGB+TBqaaRlv+3zN+ zkjKQFA2jNL14hwI8w6b5VEB0Wlq+uMBscZvuE3foEthKmlMLJoGRfls65OyOWSnVwxJ UwbRX86Qo++axUGRLjLfVehSqvszOM6/kWrZ4onyeJe+irq9qLzlpCrXhgiWf4YU2ZR7 LD0VVxACoF1M2CkhtMjG7Uo1LBWlLYsw/W3ZvbQCErvAhx6d1KxTq1OPk/Fy7HycvHSb 1P3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XnuIGDHz+vWuMXJWxtX9N5UENBs226CX5hzP3bDj+NE=; b=dEJwn5T7Icor5ZTHJiZlIsNXdpGJawT1RL4/W17LW1/ufVBI9oj1egsidrJYJ+wp4W XKwGlU3Wi95RVGb7E1TH4Kykt0J9+abLaPSG+22rCeGAab9moYHLEwfkGuzPsmUThflp eZb/Yg7UHql1qsByJnJEcBr6Eslxdmacwzz11n/Ck+cT9WLt4WS4pCwqvtun9XtxGtFl Ewijm7vURakMdfpDsZcm0n/hb+KcVjyL83j9Rn50fYVApynab8BGREHFaLIGW57L+AxR HLak64U1hvSZBTJxSYtZtqs+4c2gQKZJwU+/KFPXJVA0z/LGBPs4MkIqoLc1cRMsM3XE KLTg== X-Gm-Message-State: AOAM532kX1ZWUn1ysLO/xN0xFC/VrtDBccSf6hOeBDh2cNYALugAs6DY o3C9y95faM8eXBtkC071Tc8= X-Google-Smtp-Source: ABdhPJwRMr947DzuupSIRzSqQlbwxhpXzwE8XuPrSB3NgTjdSx/m6FxyYhl99GiFfU0NkPnDemFp9g== X-Received: by 2002:ac2:4ed9:: with SMTP id p25mr14223916lfr.576.1620595603784; Sun, 09 May 2021 14:26:43 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id j16sm1984029lfe.152.2021.05.09.14.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 14:26:43 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Sun, 9 May 2021 23:26:41 +0200 To: Matthew Wilcox Cc: Uladzislau Rezki , Andrew Morton , linux-mm@kvack.org, LKML , Nicholas Piggin , Mel Gorman , Hillf Danton , Michal Hocko , Oleksiy Avramchenko , Steven Rostedt Subject: Re: [PATCH v2 2/2] mm/vmalloc: Print a warning message first on failure Message-ID: <20210509212641.GA3220@pc638.lan> References: <20210509193844.2562-1-urezki@gmail.com> <20210509193844.2562-2-urezki@gmail.com> <20210509200519.GA3016@pc638.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2AC7A40002F0 X-Stat-Signature: uit1471tbs85jtritergs1ejzmu6em3c Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=YtCpBUB7; spf=pass (imf26.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.48 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail-lf1-f48.google.com; client-ip=209.85.167.48 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620595592-357947 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 Sun, May 09, 2021 at 09:18:46PM +0100, Matthew Wilcox wrote: > On Sun, May 09, 2021 at 10:05:19PM +0200, Uladzislau Rezki wrote: > > On Sun, May 09, 2021 at 08:47:12PM +0100, Matthew Wilcox wrote: > > > > +++ b/mm/vmalloc.c > > > > @@ -2781,11 +2781,11 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, > > > > } > > > > > > > > if (!area->pages) { > > > > - free_vm_area(area); > > > > warn_alloc(gfp_mask, NULL, > > > > "vmalloc size %lu allocation failure: " > > > > "page array size %lu allocation failed", > > > > nr_small_pages * PAGE_SIZE, array_size); > > > > + free_vm_area(area); > > > > return NULL; > > > > } > > > > > > I think this is a bad idea. We're clearly low on memory (a memory > > > allocation just failed). We should free the memory we have allocated > > > to improve the chances of the warning message making it out. > > Not sure if i fully follow you here. We do free the memory. The intention > > was to print a warning message first because, if, potentially, the > > free_vm_area(area) also does some prints it would be a bit messy from the > > point what has been broken first. > > > > So, could you please clarify what was your concern? > > We may need to allocate memory in order to emit the error message. > > Your commit message didn't mention the potential confusion, and I think > that is worth adding for a v4. I agree that the commit message should be updated in regard of potential confusion, because it was the main intention of this patch. I will upload a v4 tomorrow. -- Vlad Rezki