From patchwork Wed Sep 15 11:43:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12496071 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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 3137FC433F5 for ; Wed, 15 Sep 2021 11:43:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9AFB6121F for ; Wed, 15 Sep 2021 11:43:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B9AFB6121F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1DBF16B0071; Wed, 15 Sep 2021 07:43:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18BCB6B0072; Wed, 15 Sep 2021 07:43:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A17B6B0073; Wed, 15 Sep 2021 07:43:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0100.hostedemail.com [216.40.44.100]) by kanga.kvack.org (Postfix) with ESMTP id EE78E6B0071 for ; Wed, 15 Sep 2021 07:43:17 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9625D1809CD70 for ; Wed, 15 Sep 2021 11:43:17 +0000 (UTC) X-FDA: 78589622034.25.29C3951 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf07.hostedemail.com (Postfix) with ESMTP id F2E6910000B4 for ; Wed, 15 Sep 2021 11:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:Subject :From; bh=81lya9o+zF6tso2afua76Z8Or6SzheGH2IL+qPP3swU=; b=e1kLTcI7TqaW2QAtOkP 7WX4J+NclS5N7WYGLw0iLtT7eiDqLdZ41kP+wfILI54kWWVsoM05DJbmXJ9YC2sHbEMZWy6LrUumn iT0FN56YMTkbO7AwhBl+Hh4F8dTJFCdK4FnZhnav7hXk6Rj7kFs4zk1xdIzUGrP0c5RYYnIFVpM=; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mQTJn-0024Zj-4u; Wed, 15 Sep 2021 14:43:11 +0300 From: Vasily Averin Subject: [PATCH mm] mm/vmalloc: repair warn_alloc()s in __vmalloc_area_node() To: Christoph Hellwig , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel@openvz.org Message-ID: Date: Wed, 15 Sep 2021 14:43:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Language: en-US X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: F2E6910000B4 X-Stat-Signature: hexeaeyms33bmnq93cebmygmsphugmf8 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=virtuozzo.com header.s=relay header.b=e1kLTcI7; spf=pass (imf07.hostedemail.com: domain of vvs@virtuozzo.com designates 185.231.240.75 as permitted sender) smtp.mailfrom=vvs@virtuozzo.com; dmarc=pass (policy=quarantine) header.from=virtuozzo.com X-HE-Tag: 1631706196-984399 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: Commit f255935b9767 ("mm: cleanup the gfp_mask handling in __vmalloc_area_node") added __GFP_NOWARN to gfp_mask unconditionally however it disabled all output inside warn_alloc() call. This patch saves original gfp_mask and provides it to all warn_alloc() calls. Fixes: f255935b9767 ("mm: cleanup the gfp_mask handling in __vmalloc_area_node") Cc: Christoph Hellwig Signed-off-by: Vasily Averin Reviewed-by: Christoph Hellwig Reviewed-by: Muchun Song --- mm/vmalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 551011399974..ff8538b1b28f 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2888,6 +2888,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, int node) { const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; + const gfp_t orig_gfp_mask = gfp_mask; unsigned long addr = (unsigned long)area->addr; unsigned long size = get_vm_area_size(area); unsigned long array_size; @@ -2908,7 +2909,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, } if (!area->pages) { - warn_alloc(gfp_mask, NULL, + warn_alloc(orig_gfp_mask, NULL, "vmalloc error: size %lu, failed to allocated page array size %lu", nr_small_pages * PAGE_SIZE, array_size); free_vm_area(area); @@ -2928,7 +2929,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, * allocation request, free them via __vfree() if any. */ if (area->nr_pages != nr_small_pages) { - warn_alloc(gfp_mask, NULL, + warn_alloc(orig_gfp_mask, NULL, "vmalloc error: size %lu, page order %u, failed to allocate pages", area->nr_pages * PAGE_SIZE, page_order); goto fail; @@ -2936,7 +2937,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, if (vmap_pages_range(addr, addr + size, prot, area->pages, page_shift) < 0) { - warn_alloc(gfp_mask, NULL, + warn_alloc(orig_gfp_mask, NULL, "vmalloc error: size %lu, failed to map pages", area->nr_pages * PAGE_SIZE); goto fail;