From patchwork Wed Jan 19 14:35:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 12717586 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B184BC433F5 for ; Wed, 19 Jan 2022 14:35:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32A766B0074; Wed, 19 Jan 2022 09:35:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B3EF6B0075; Wed, 19 Jan 2022 09:35:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12C686B0078; Wed, 19 Jan 2022 09:35:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay027.a.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 05B3E6B0074 for ; Wed, 19 Jan 2022 09:35:55 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D172D20FD8 for ; Wed, 19 Jan 2022 14:35:54 +0000 (UTC) X-FDA: 79047285828.02.BEC62A4 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by imf17.hostedemail.com (Postfix) with ESMTP id 915B140005 for ; Wed, 19 Jan 2022 14:35:53 +0000 (UTC) Received: by mail-lf1-f46.google.com with SMTP id p27so10287552lfa.1 for ; Wed, 19 Jan 2022 06:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z9oiupD+98sSYT2szp0bLOwe4Lp388kc2c/Co3Zp20I=; b=DkBxkk35wBe59Gksv6JiqbrdxzGUwLOrGyTJhhy8vVZTCT5xTk25u+QwCD8Zc835cC A5DcJiMy9xFo99+1hA5oSRiGEboKjGKZIOZXBDxCr7b+IjjCzsdoK1x9cf7lHsZSo2Cp amV/ET45+C79+LvO7+T88ztmz+nBGat4of/DRX1qGD8hL8u6RET2eybE3ko/j+tFJxMQ pFL0fAfH/GtYiC/zcJlNxq3uNWC8NCEXXsXTV4Vb2Awyu35xssXPfb7d6LTqpWtT9pjH iKT9rySlIXxTw3OVrhqQ66IWHHQVnPV31vjBw6rgRtwmhQfRRzB42hOOwYkgwzest7wF QpHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z9oiupD+98sSYT2szp0bLOwe4Lp388kc2c/Co3Zp20I=; b=68XA6w8QzE9YbaHo9pp4vFsRde7nG24zlUL1POURhbnKl8frpTYlPjic9mX6rNt4X9 zJ9GiKRyDjgfZDwhBWIEcLuXBMo46iKsvBUs/Grxwiei9aSejvf8ebTeorTc+a490L1q QeGwilU9zLEIjaitaIpXul4fu5+udRcdhuSDouz42ZoCXkk+QPgu//HRUXiX1g2wBgsE UpV0PKL8VC8j7ZRPN7GE62cKNranpDfIFHG9NNfvcglM4jIED5PJjQrmX5Cvpu7+PeYr XF7zdT8Bh7KCiwW6yv5y8/yyaejaNz8mdD7p9+8s33A8G/P6IhjjU8Pzvew/mbXR8AUv n4sg== X-Gm-Message-State: AOAM53076JGjyLZSOs0fy/Fk2rWQhMMr007zTVrK8N4efhKWL+ZshHyL JMU1uht9XtunoyTaAl3QFw4= X-Google-Smtp-Source: ABdhPJziXjs/bTyN3grnU5EX0UYhEFJOpdfOQmpkVInGM8LY6uzrjQhrAVII7Ys9JfV4ARZEMRyGXQ== X-Received: by 2002:ac2:5c41:: with SMTP id s1mr28901657lfp.440.1642602952277; Wed, 19 Jan 2022 06:35:52 -0800 (PST) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id z13sm179943lfr.183.2022.01.19.06.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 06:35:50 -0800 (PST) From: "Uladzislau Rezki (Sony)" To: Andrew Morton Cc: linux-mm@kvack.org, LKML , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Uladzislau Rezki , Oleksiy Avramchenko , Vasily Averin Subject: [PATCH 3/3] mm/vmalloc: Eliminate an extra orig_gfp_mask Date: Wed, 19 Jan 2022 15:35:40 +0100 Message-Id: <20220119143540.601149-3-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220119143540.601149-1-urezki@gmail.com> References: <20220119143540.601149-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 915B140005 X-Stat-Signature: qnoygbc9xq1enz7renbfe4pws5tmx9z5 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DkBxkk35; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.46 as permitted sender) smtp.mailfrom=urezki@gmail.com X-HE-Tag: 1642602953-524399 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: That extra variable has been introduced just for keeping an original passed gfp_mask because it is updated with __GFP_NOWARN on entry, thus error handling messages were broken. Instead we can keep an original gfp_mask without modifying it and add an extra __GFP_NOWARN flag together with gfp_mask as a parameter to the vm_area_alloc_pages() function. It will make it less confused. Cc: Vasily Averin Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 52ee67107046..04edd32ba6bc 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2953,7 +2953,6 @@ 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; bool nofail = gfp_mask & __GFP_NOFAIL; unsigned long addr = (unsigned long)area->addr; unsigned long size = get_vm_area_size(area); @@ -2967,7 +2966,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, max_small_pages = ALIGN(size, 1UL << page_shift) >> PAGE_SHIFT; array_size = (unsigned long)max_small_pages * sizeof(struct page *); - gfp_mask |= __GFP_NOWARN; if (!(gfp_mask & (GFP_DMA | GFP_DMA32))) gfp_mask |= __GFP_HIGHMEM; @@ -2980,7 +2978,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, } if (!area->pages) { - warn_alloc(orig_gfp_mask, NULL, + warn_alloc(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); @@ -2990,8 +2988,8 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, set_vm_area_page_order(area, page_shift - PAGE_SHIFT); page_order = vm_area_page_order(area); - area->nr_pages = vm_area_alloc_pages(gfp_mask, node, - page_order, nr_small_pages, area->pages); + area->nr_pages = vm_area_alloc_pages(gfp_mask | __GFP_NOWARN, + node, page_order, nr_small_pages, area->pages); atomic_long_add(area->nr_pages, &nr_vmalloc_pages); if (gfp_mask & __GFP_ACCOUNT) { @@ -3007,7 +3005,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(orig_gfp_mask, NULL, + warn_alloc(gfp_mask, NULL, "vmalloc error: size %lu, page order %u, failed to allocate pages", area->nr_pages * PAGE_SIZE, page_order); goto fail; @@ -3035,7 +3033,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, memalloc_noio_restore(flags); if (ret < 0) { - warn_alloc(orig_gfp_mask, NULL, + warn_alloc(gfp_mask, NULL, "vmalloc error: size %lu, failed to map pages", area->nr_pages * PAGE_SIZE); goto fail;