From patchwork Mon Dec 27 00:32:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 529283 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E075C433EF for ; Mon, 27 Dec 2021 00:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234869AbhL0AcY (ORCPT ); Sun, 26 Dec 2021 19:32:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57300 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234866AbhL0AcY (ORCPT ); Sun, 26 Dec 2021 19:32:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26ECF60F28; Mon, 27 Dec 2021 00:32:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08A7DC36AE9; Mon, 27 Dec 2021 00:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1640565143; bh=p9BiVUfUO6I8WPgaJFDEg5uZE2LjrzAk3kkkgBpS5NM=; h=Date:From:To:Subject:From; b=UjB8Q/LYp1+nXoJvORd10qcuoSkPo6uF70L+GUPpjTU1aOqbYs07fh1noEmkZufd5 qWTVK2LS2TxemxyBWQlQ9q7qyR4XSITaf7SPiAL/ipSMXbWEpFZxckqXoRfUyGq5h6 sxQ0R1xG1u85dbwBVMt9Y9RODLyN9ov8zNbBe7oM= Date: Sun, 26 Dec 2021 16:32:22 -0800 From: akpm@linux-foundation.org To: mm-commits@vger.kernel.org, vbabka@suse.cz, stable@vger.kernel.org, robin.murphy@arm.com, rientjes@google.com, penberg@kernel.org, m.szyprowski@samsung.com, john.p.donnelly@oracle.com, iamjoonsoo.kim@lge.com, hch@lst.de, david@redhat.com, David.Laight@ACULAB.COM, cl@linux.com, bp@alien8.de, 42.hyeyoo@gmail.com, bhe@redhat.com Subject: + mm-page_allocc-do-not-warn-allocation-failure-on-zone-dma-if-no-managed-pages.patch added to -mm tree Message-ID: <20211227003222.A33t0%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed pages has been added to the -mm tree. Its filename is mm-page_allocc-do-not-warn-allocation-failure-on-zone-dma-if-no-managed-pages.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-page_allocc-do-not-warn-allocation-failure-on-zone-dma-if-no-managed-pages.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-page_allocc-do-not-warn-allocation-failure-on-zone-dma-if-no-managed-pages.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Baoquan He Subject: mm/page_alloc.c: do not warn allocation failure on zone DMA if no managed pages In kdump kernel of x86_64, page allocation failure is observed: kworker/u2:2: page allocation failure: order:0, mode:0xcc1(GFP_KERNEL|GFP_DMA), nodemask=(null),cpuset=/,mems_allowed=0 CPU: 0 PID: 55 Comm: kworker/u2:2 Not tainted 5.16.0-rc4+ #5 Hardware name: AMD Dinar/Dinar, BIOS RDN1505B 06/05/2013 Workqueue: events_unbound async_run_entry_fn Call Trace: dump_stack_lvl+0x48/0x5e warn_alloc.cold+0x72/0xd6 __alloc_pages_slowpath.constprop.0+0xc69/0xcd0 __alloc_pages+0x1df/0x210 new_slab+0x389/0x4d0 ___slab_alloc+0x58f/0x770 __slab_alloc.constprop.0+0x4a/0x80 kmem_cache_alloc_trace+0x24b/0x2c0 sr_probe+0x1db/0x620 ...... device_add+0x405/0x920 ...... __scsi_add_device+0xe5/0x100 ata_scsi_scan_host+0x97/0x1d0 async_run_entry_fn+0x30/0x130 process_one_work+0x1e8/0x3c0 worker_thread+0x50/0x3b0 ? rescuer_thread+0x350/0x350 kthread+0x16b/0x190 ? set_kthread_struct+0x40/0x40 ret_from_fork+0x22/0x30 Mem-Info: ...... The above failure happened when calling kmalloc() to allocate buffer with GFP_DMA. It requests to allocate slab page from DMA zone while no managed pages at all in there. sr_probe() --> get_capabilities() --> buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); Because in the current kernel, dma-kmalloc will be created as long as CONFIG_ZONE_DMA is enabled. However, kdump kernel of x86_64 doesn't have managed pages on DMA zone since commit 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashkernel option is specified"). The failure can be always reproduced. For now, let's mute the warning of allocation failure if requesting pages from DMA zone while no managed pages. Link: https://lkml.kernel.org/r/20211223094435.248523-4-bhe@redhat.com Fixes: 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashkernel option is specified") Signed-off-by: Baoquan He Acked-by: John Donnelly Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Vlastimil Babka Cc: Borislav Petkov Cc: Christoph Hellwig Cc: David Hildenbrand Cc: David Laight Cc: Marek Szyprowski Cc: Robin Murphy Cc: Signed-off-by: Andrew Morton --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/page_alloc.c~mm-page_allocc-do-not-warn-allocation-failure-on-zone-dma-if-no-managed-pages +++ a/mm/page_alloc.c @@ -4218,7 +4218,8 @@ void warn_alloc(gfp_t gfp_mask, nodemask va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); - if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) + if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) || + (gfp_mask & __GFP_DMA) && !has_managed_dma()) return; va_start(args, fmt);