From nobody Sun Jul 13 07:27:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bfxqS4pnQz61ppm; Sun, 13 Jul 2025 07:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bfxqR70d4z3H31; Sun, 13 Jul 2025 07:27:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752391652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZukLrc1x89YuIVKXQLHlepKFvPVSmGroywCCCmjqjK8=; b=MuTkfh2nvzk5oTCiG6MCNgl1dzoXNoMzGm9vdTBRtPiskQ5QKvFcn3Enzw+4jQN89oLTRW OUiRUmewTR5Mf/iHFgKxoc+oT45OWIMVXTnqEwW5WMGBW01+0I31JZcohKOPGK6OpHhjsd cmhuuYMuIWhehyBHqncKP6ej+nnFtmMbtUJPWtCD5X2awx8hmRXsvlnVtdwxDClZSeLZSw 0gfG1L0mx/OQKVN+s8C+/v7GETjE5+nwLmZiCPjQKnYdoL+75JtkBInrSrCi7T9ozXOg3E 1l+QHqTaMCkIQYOTLgk43+sZ2lW6WHP05nmxw9EUfTGK+vzxd4ZcvPcOURYzVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752391652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZukLrc1x89YuIVKXQLHlepKFvPVSmGroywCCCmjqjK8=; b=FFFKJr5pOpYbEn0dFbaSM+pZhVUF9a4B6f/gfIhpx2TMoEOWIOjbAFKWdOQOaoELrvxmHT FXaTyGJswVwqmSzdNd5kzmCJjJAuwhKuZ73f+QmThjAGGhHhAlFrWs8Ct9A+Rru6okTMFN 7kLgpyO8tO8vG+/uETTIBNBO7G068qcDIHvn26zIz3V24BVpyuPBBwtgVuxXJDVohpdRuk hAmzWUY0MH2sdLhFg+COA4dCL01ETPDVdDbeGLlYaGPTDFwB06vsFAuDDj1gLd0C6iHyPl MQUqNhVPBKP/N93QLTalALMmQ/5LmyxxHLjMnpe65oJEOgQ9FWUS3VjnfFvy9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752391652; a=rsa-sha256; cv=none; b=j7PjMFss3oZci8Ht9xR3cQKZLoRMd6yU7RxxdZsIyLW7wMFvLUxvZpf+TfSjr0RtXeuj5y dRyhRsLTNlu6CsDgOWIC9omMWkU8MYogmszUcIkn0diuddU2OAaWolGZ3vbbeu7Lv1qMfO OR7PO1AF9E6kjrkQJE6rbZaQVLjizMVF5hZ6oxgsjwI+gZB1q1AVQFgyfJfuUzQkfdJJ/E wayZqIfJmU1kSNuHIDlGppg5sBgc/L5C3piLNAs7G6uMYVYG6exovz/jcl6GexIQJF1aMT B5krgUayP83vYi/VrvF/a+yE9+wGIjxs6Wcu1eWlzKdVcWgrkuoJfmVQIbbB6w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bfxqR69KXzygw; Sun, 13 Jul 2025 07:27:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56D7RVNW094666; Sun, 13 Jul 2025 07:27:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56D7RVUA094663; Sun, 13 Jul 2025 07:27:31 GMT (envelope-from git) Date: Sun, 13 Jul 2025 07:27:31 GMT Message-Id: <202507130727.56D7RVUA094663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 4ca9190251bb - main - LinuxKPI: alloc_pages(): Don't reclaim on __GFP_NORETRY List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ca9190251bbd00c928a3cba54712c3ec25e9e26 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=4ca9190251bbd00c928a3cba54712c3ec25e9e26 commit 4ca9190251bbd00c928a3cba54712c3ec25e9e26 Author: Olivier Certner AuthorDate: 2025-07-07 12:27:48 +0000 Commit: Olivier Certner CommitDate: 2025-07-13 06:41:19 +0000 LinuxKPI: alloc_pages(): Don't reclaim on __GFP_NORETRY Pass VM_ALLOC_NORECLAIM to vm_page_alloc_noobj_contig() so that it avoids reclaiming (currently, calling vm_reserv_reclaim_contig()). According to Linux's documentation, __GFP_NORETRY should not cause any "disruptive reclaim". alloc_pages() is called a lot from the amdgpu DRM driver via ttm_pool_alloc(), which tries to allocate pages of the highest order first and fallback to lower order pages (as allocating contiguous physical pages is in fact not a requirement). This process relies on failing fast, as requested by __GFP_NORETRY. See also related commit 718d1928f874 ("LinuxKPI: make linux_alloc_pages() honor __GFP_NORETRY"). Reviewed by: jeffpc_josefsipek.net, bz MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51246 --- sys/compat/linuxkpi/common/src/linux_page.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index ebb92eacbf9a..628af17df853 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -106,6 +106,7 @@ linux_alloc_pages(gfp_t flags, unsigned int order) if ((flags & M_ZERO) != 0) req |= VM_ALLOC_ZERO; + if (order == 0 && (flags & GFP_DMA32) == 0) { page = vm_page_alloc_noobj(req); if (page == NULL) @@ -113,6 +114,10 @@ linux_alloc_pages(gfp_t flags, unsigned int order) } else { vm_paddr_t pmax = (flags & GFP_DMA32) ? BUS_SPACE_MAXADDR_32BIT : BUS_SPACE_MAXADDR; + + if ((flags & __GFP_NORETRY) != 0) + req |= VM_ALLOC_NORECLAIM; + retry: page = vm_page_alloc_noobj_contig(req, npages, 0, pmax, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);