From patchwork Wed Nov 3 20:07:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 12601547 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63D38C433F5 for ; Wed, 3 Nov 2021 20:14:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EBC3E60551 for ; Wed, 3 Nov 2021 20:14:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EBC3E60551 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 81EED6B0072; Wed, 3 Nov 2021 16:14:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CD546B0073; Wed, 3 Nov 2021 16:14:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BCCE940007; Wed, 3 Nov 2021 16:14:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 5BF2A6B0072 for ; Wed, 3 Nov 2021 16:14:37 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 226D17145E for ; Wed, 3 Nov 2021 20:14:37 +0000 (UTC) X-FDA: 78768721794.17.5C7D650 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by imf10.hostedemail.com (Postfix) with ESMTP id 02A0D6001995 for ; Wed, 3 Nov 2021 20:14:25 +0000 (UTC) Received: by mail-wr1-f43.google.com with SMTP id t30so5311502wra.10 for ; Wed, 03 Nov 2021 13:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NPgQOWllbolCn3GA8pPnlXJFYgWP5jNVx5VhxEy+M4I=; b=hTHwtSsmO30+AU1dwz0KwbQnD7qLpZDbaiRaqoBo5FPPp0MyVotAP47eUpoLz+ksIx Qxzt3wnaMqazN0CZE2oQ/BWQO37t5AvewcFECrllBAO/jt1OSU6gzRkSOxcUd4Edc1ok 0qKydQtH2EqQvmGfjrhFK3NkPjH9yjq24JMOfoxqaDjF8wUEgcSZweHVJ4t8n/G6H4oQ VoEW2MoFKXes1a8D/rndkZjFAeOdNv1YQ25TggiEUTWFwGOJPhuaUrDpTzWarzf7h4Ob YUzWKhvRjteret1SN2ARmUkwkHlkV5ihAAOgkY6YHyToqah0H/s/EPinAlTGO1WAkfjU CAEg== 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:mime-version :content-transfer-encoding; bh=NPgQOWllbolCn3GA8pPnlXJFYgWP5jNVx5VhxEy+M4I=; b=Dbsd5de1nC1UR6zFhenK5N/kMdnLMa8IUAgDr+HMM5lMdW7OhJU9RI7xN1AVIyZfs0 1ZjUea5O9roFcX0yvePndcUQyJff3C9hUvRoN8s4NcMycu8RcaaDFtUU+Pdu/KQyGDc3 mDa6Ud4pu1H2jPaDZc9gLiU3qF2T4fnhsilYv8D+K7a1WIpL+tmGPg68xCNhWqASgaIj IzBkqsG1DJGBqMO5OW3ucNPArhQYvdV92DTMQzub1rHc6v4HASSd937I+xlBu4YPUGVa Pyho4IkWJkeEiceWip+JB4QuQWdlVXOV2mNopPvCux24+Lmm1HRx3BrISD9j0Q6G4/SY dx5Q== X-Gm-Message-State: AOAM531r6O0f9a7mcl3TKq9kMm5fUxwhszSYhKozC7QWZQuvUBSczjdB J2GKwJ2Zv3v3PKx4X3mz3tFq8yvkywtz/A== X-Google-Smtp-Source: ABdhPJy8hfy2Cv1OWaCUXjQgRl9PW42lSjmMNzP+bbfdJKHMcXMQHOs8n80BwJ1qdxYi/AwrLm4DLQ== X-Received: by 2002:a19:c352:: with SMTP id t79mr2168599lff.251.1635970032842; Wed, 03 Nov 2021 13:07:12 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id u5sm288984lfo.280.2021.11.03.13.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 13:07:12 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: Andrew Morton Cc: linux-mm@kvack.org, LKML , Mel Gorman , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Uladzislau Rezki , Hillf Danton , Michal Hocko , Oleksiy Avramchenko , Steven Rostedt Subject: [PATCH] mm/vmalloc: Eliminate an extra orig_gfp_mask Date: Wed, 3 Nov 2021 21:07:03 +0100 Message-Id: <20211103200703.2265-1-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Stat-Signature: qa14bk8w9n3yfu1px6cyuxt4exea955c X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 02A0D6001995 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=hTHwtSsm; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of urezki@gmail.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=urezki@gmail.com X-HE-Tag: 1635970465-921731 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. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index d2a00ad4e1dd..3b549ff5c95e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2920,7 +2920,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; unsigned long addr = (unsigned long)area->addr; unsigned long size = get_vm_area_size(area); unsigned long array_size; @@ -2928,7 +2927,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, unsigned int page_order; array_size = (unsigned long)nr_small_pages * sizeof(struct page *); - gfp_mask |= __GFP_NOWARN; + if (!(gfp_mask & (GFP_DMA | GFP_DMA32))) gfp_mask |= __GFP_HIGHMEM; @@ -2941,7 +2940,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); @@ -2951,8 +2950,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); @@ -2961,7 +2960,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; @@ -2969,7 +2968,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(orig_gfp_mask, NULL, + warn_alloc(gfp_mask, NULL, "vmalloc error: size %lu, failed to map pages", area->nr_pages * PAGE_SIZE); goto fail;