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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 1EFF0C433B4 for ; Sun, 9 May 2021 20:19:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94E9561401 for ; Sun, 9 May 2021 20:19:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94E9561401 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5ABA06B0070; Sun, 9 May 2021 16:19:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 532DF6B0071; Sun, 9 May 2021 16:19:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3859C6B0072; Sun, 9 May 2021 16:19:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 19DB26B0070 for ; Sun, 9 May 2021 16:19:04 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D175A181AF5C2 for ; Sun, 9 May 2021 20:19:03 +0000 (UTC) X-FDA: 78122806566.01.9DDF5D1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id A9F79C0007C5 for ; Sun, 9 May 2021 20:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gJmXxlTN6rNvfW9sJ9K5q4pJoGjV9mdc8xEmZfcA8PA=; b=Cb6qMNlOzrOrWSTOYEUMxDgDmU s18pw/YUGFRKlGnLFOypDuscRPxoiAfTZD/vFgZkmW3tVRC3D1IECAUiFkGg78Bllplqdt8VTOhfj YtX5c6zuUSB/tZrGrT/bC37WcK+g5reZdWkxLKqaFJC58w1XjxPdeVrslT4NY/RfF+RLA8J3aR9BW 5QJFTgCZrkW1sLVf/e9PqhC2JUCstdqzkK/4nMSiRRrN/FIwLwNQ1ukftdko8J8rPmIrfHeUFOxyy 93V0aULj+wBVRU4aMbr7Tad1EQX0KSy+d9LB6cvmvN0JR9++0CYJ2Us1qnQdPN0uxsnL1n3nKKip2 w+Qfnv1w==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lfpt0-005OzZ-4l; Sun, 09 May 2021 20:18:48 +0000 Date: Sun, 9 May 2021 21:18:46 +0100 From: Matthew Wilcox To: Uladzislau Rezki Cc: 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: 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: <20210509200519.GA3016@pc638.lan> Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Cb6qMNlO; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A9F79C0007C5 X-Stat-Signature: emm7cmc3obpj7zrzpgo1wbsi6ntbubrz Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620591535-401036 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 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.