From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F94C2F2C for ; Mon, 7 Feb 2022 23:49:23 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id v13-20020a17090ac90d00b001b87bc106bdso557545pjt.4 for ; Mon, 07 Feb 2022 15:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=srqNW1EcIXWSL3YA9DB/cq+5wKzOkrj3L8GZFZFPp88=; b=01MLVSpGJcOLNshddxkhtSXXihKsoNqdx5vMNxTFv6bN6BYo1SzUvt/9GrJao02HnF Hb+sjT0ujjyEhZBcYaEd66uhrH2U82Bpll97CF5ng/E4ARrZPgn+43XxHckYHlvbZ2cV f+jtU4mZKMkJCdUAiiqidQXrgC4Uo9dYltnKCJah1zHCywOpfDTIJzzdLCdSte1qGkst 3TMcL8koigGPS26Czk0t/YynCFMadqyzQa7PlOBrn/XujPHTtuWh/oT8H0p3MLl7Uhro o0Gdsh8bSiaHc0CBUQxnZNfGeQPOMJTi12vYqWQkg/+GUCDwEzHRF9C80zL1n7F4WwGt uBog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=srqNW1EcIXWSL3YA9DB/cq+5wKzOkrj3L8GZFZFPp88=; b=DNvZBTxo+R24lhOKIS178VT4XW1cuSqryM8eB813dgGFem5MrAB1gx73VoWG1gUVYO CNFDTdiE3oXlbQKWTbaJlMnfvX13UO7Skn147x0iC1Nok8PXtPqlQPUUu5MfgQn/gpdx NTT88bPLwyTCZDrtHMuzTVeGOM9nEco7DCvlQZZSN5IdckTGwdqr7yLFekQtgFUEq6N9 R05XQxaorpktxcd419wIfeaNkggKo92VCZgU0m3CMHDBFk6q0TUSyYAlRjJnnyfPpgzd YrEKi10DB/y8HtJHW3yqea+PwnlJcoWCQu08gCCijDX7oT6rfG/zK/BiytOpjSToEmYy n9Hw== X-Gm-Message-State: AOAM5337yKGvr5Hv8UoJ5KX8+rhFoSOcvw4I62PGWhDNtq7NYcEN3Zm+ 6Ro3pkKmNqlf1XWFZz64YKoNF2Mi9QXIsgIkU9OLww== X-Google-Smtp-Source: ABdhPJxFGt5Dntgj+qwGhvXaFOpnQvWG0jHZ1p4j/IHgmQmdfIUoMiD/D2bs8RfxGHBUeq0VHi5bSlkknn7IBqEisQo= X-Received: by 2002:a17:902:ccce:: with SMTP id z14mr1978185ple.34.1644277763021; Mon, 07 Feb 2022 15:49:23 -0800 (PST) Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220207063249.1833066-1-hch@lst.de> <20220207063249.1833066-7-hch@lst.de> In-Reply-To: <20220207063249.1833066-7-hch@lst.de> From: Dan Williams Date: Mon, 7 Feb 2022 15:49:12 -0800 Message-ID: Subject: Re: [PATCH 6/8] mm: don't include in To: Christoph Hellwig Cc: Andrew Morton , Felix Kuehling , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , Ben Skeggs , Karol Herbst , Lyude Paul , Jason Gunthorpe , Alistair Popple , Logan Gunthorpe , Ralph Campbell , Linux Kernel Mailing List , amd-gfx list , Maling list - DRI developers , nouveau@lists.freedesktop.org, Linux NVDIMM , Linux MM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > Move the check for the actual pgmap types that need the free at refcount > one behavior into the out of line helper, and thus avoid the need to > pull memremap.h into mm.h. Looks good to me assuming the compile bots agree. Reviewed-by: Dan Williams > > Signed-off-by: Christoph Hellwig > --- > arch/arm64/mm/mmu.c | 1 + > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + > drivers/gpu/drm/drm_cache.c | 2 +- > drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 + > drivers/gpu/drm/nouveau/nouveau_svm.c | 1 + > drivers/infiniband/core/rw.c | 1 + > drivers/nvdimm/pmem.h | 1 + > drivers/nvme/host/pci.c | 1 + > drivers/nvme/target/io-cmd-bdev.c | 1 + > fs/fuse/virtio_fs.c | 1 + > include/linux/memremap.h | 18 ++++++++++++++++++ > include/linux/mm.h | 20 -------------------- > lib/test_hmm.c | 1 + > mm/memremap.c | 6 +++++- > 14 files changed, 34 insertions(+), 22 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index acfae9b41cc8c9..580abae6c0b93f 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/= amdkfd/kfd_priv.h > index ea68f3b3a4e9cb..6d643b4b791d87 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > @@ -25,6 +25,7 @@ > > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c > index f19d9acbe95936..50b8a088f763a6 100644 > --- a/drivers/gpu/drm/drm_cache.c > +++ b/drivers/gpu/drm/drm_cache.c > @@ -27,11 +27,11 @@ > /* > * Authors: Thomas Hellstr=C3=B6m > */ > - > #include > #include > #include > #include > +#include > #include > > #include > diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nou= veau/nouveau_dmem.c > index e886a3b9e08c7d..a5cdfbe32b5e54 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c > @@ -39,6 +39,7 @@ > > #include > #include > +#include > #include > > /* > diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouv= eau/nouveau_svm.c > index 266809e511e2c1..090b9b47708cca 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_svm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > > struct nouveau_svm { > diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c > index 5a3bd41b331c93..4d98f931a13ddd 100644 > --- a/drivers/infiniband/core/rw.c > +++ b/drivers/infiniband/core/rw.c > @@ -2,6 +2,7 @@ > /* > * Copyright (c) 2016 HGST, a Western Digital Company. > */ > +#include > #include > #include > #include > diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h > index 59cfe13ea8a85c..1f51a23614299b 100644 > --- a/drivers/nvdimm/pmem.h > +++ b/drivers/nvdimm/pmem.h > @@ -3,6 +3,7 @@ > #define __NVDIMM_PMEM_H__ > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index 6a99ed68091589..ab15bc72710dbe 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-c= md-bdev.c > index 70ca9dfc1771a9..a141446db1bea3 100644 > --- a/drivers/nvme/target/io-cmd-bdev.c > +++ b/drivers/nvme/target/io-cmd-bdev.c > @@ -6,6 +6,7 @@ > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > #include > #include > +#include > #include > #include "nvmet.h" > > diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c > index 9d737904d07c0b..86b7dbb6a0d43e 100644 > --- a/fs/fuse/virtio_fs.c > +++ b/fs/fuse/virtio_fs.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/include/linux/memremap.h b/include/linux/memremap.h > index 1fafcc38acbad6..514ab46f597e5c 100644 > --- a/include/linux/memremap.h > +++ b/include/linux/memremap.h > @@ -1,6 +1,8 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #ifndef _LINUX_MEMREMAP_H_ > #define _LINUX_MEMREMAP_H_ > + > +#include > #include > #include > #include > @@ -129,6 +131,22 @@ static inline unsigned long pgmap_vmemmap_nr(struct = dev_pagemap *pgmap) > return 1 << pgmap->vmemmap_shift; > } > > +static inline bool is_device_private_page(const struct page *page) > +{ > + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > + IS_ENABLED(CONFIG_DEVICE_PRIVATE) && > + is_zone_device_page(page) && > + page->pgmap->type =3D=3D MEMORY_DEVICE_PRIVATE; > +} > + > +static inline bool is_pci_p2pdma_page(const struct page *page) > +{ > + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > + IS_ENABLED(CONFIG_PCI_P2PDMA) && > + is_zone_device_page(page) && > + page->pgmap->type =3D=3D MEMORY_DEVICE_PCI_P2PDMA; > +} > + > #ifdef CONFIG_ZONE_DEVICE > void *memremap_pages(struct dev_pagemap *pgmap, int nid); > void memunmap_pages(struct dev_pagemap *pgmap); > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 26baadcef4556b..80fccfe31c3444 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -23,7 +23,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1101,9 +1100,6 @@ static inline bool put_devmap_managed_page(struct p= age *page) > return false; > if (!is_zone_device_page(page)) > return false; > - if (page->pgmap->type !=3D MEMORY_DEVICE_PRIVATE && > - page->pgmap->type !=3D MEMORY_DEVICE_FS_DAX) > - return false; > return __put_devmap_managed_page(page); > } > > @@ -1114,22 +1110,6 @@ static inline bool put_devmap_managed_page(struct = page *page) > } > #endif /* CONFIG_DEV_PAGEMAP_OPS */ > > -static inline bool is_device_private_page(const struct page *page) > -{ > - return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > - IS_ENABLED(CONFIG_DEVICE_PRIVATE) && > - is_zone_device_page(page) && > - page->pgmap->type =3D=3D MEMORY_DEVICE_PRIVATE; > -} > - > -static inline bool is_pci_p2pdma_page(const struct page *page) > -{ > - return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > - IS_ENABLED(CONFIG_PCI_P2PDMA) && > - is_zone_device_page(page) && > - page->pgmap->type =3D=3D MEMORY_DEVICE_PCI_P2PDMA; > -} > - > /* 127: arbitrary random number, small enough to assemble well */ > #define folio_ref_zero_or_close_to_overflow(folio) \ > ((unsigned int) folio_ref_count(folio) + 127u <=3D 127u) > diff --git a/lib/test_hmm.c b/lib/test_hmm.c > index 396beee6b061d4..e5fc14ba71f33e 100644 > --- a/lib/test_hmm.c > +++ b/lib/test_hmm.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/mm/memremap.c b/mm/memremap.c > index f41233a67edb12..a0ece2344c2cab 100644 > --- a/mm/memremap.c > +++ b/mm/memremap.c > @@ -4,7 +4,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > @@ -504,6 +504,10 @@ void free_devmap_managed_page(struct page *page) > > bool __put_devmap_managed_page(struct page *page) > { > + if (page->pgmap->type !=3D MEMORY_DEVICE_PRIVATE && > + page->pgmap->type !=3D MEMORY_DEVICE_FS_DAX) > + return false; > + > /* > * devmap page refcounts are 1-based, rather than 0-based: if > * refcount is 1, then the page is free and the refcount is > -- > 2.30.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 126E5C433EF for ; Mon, 7 Feb 2022 23:49:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F31D10E11A; Mon, 7 Feb 2022 23:49:24 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E34210E11A for ; Mon, 7 Feb 2022 23:49:23 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id r64-20020a17090a43c600b001b8854e682eso906236pjg.0 for ; Mon, 07 Feb 2022 15:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=srqNW1EcIXWSL3YA9DB/cq+5wKzOkrj3L8GZFZFPp88=; b=01MLVSpGJcOLNshddxkhtSXXihKsoNqdx5vMNxTFv6bN6BYo1SzUvt/9GrJao02HnF Hb+sjT0ujjyEhZBcYaEd66uhrH2U82Bpll97CF5ng/E4ARrZPgn+43XxHckYHlvbZ2cV f+jtU4mZKMkJCdUAiiqidQXrgC4Uo9dYltnKCJah1zHCywOpfDTIJzzdLCdSte1qGkst 3TMcL8koigGPS26Czk0t/YynCFMadqyzQa7PlOBrn/XujPHTtuWh/oT8H0p3MLl7Uhro o0Gdsh8bSiaHc0CBUQxnZNfGeQPOMJTi12vYqWQkg/+GUCDwEzHRF9C80zL1n7F4WwGt uBog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=srqNW1EcIXWSL3YA9DB/cq+5wKzOkrj3L8GZFZFPp88=; b=QZ6uShLYoBWLp0U88iUxTwMIDyM+cwqe80fD3JwGWHECI/vAYcuCbOCIGjwBRRIGPQ OkNJ3JE/McfYs1y5zAqxPJ3UBB9KTnndQNA2Ym3b2wvh88rcJEG7qbqRkzAtILvLcCBp 2IIqi9yCcJnlPsOE4Bruc5AXzlEVMfpZkk2oDUaIFtEHclLIheaKK8W3x744S+oQ3jOj 9MOXzkrVYgJTR/pHQhH7XUXBfsAP8R66RRHRZqun1lxjed0X1oGqHjbZGGroNfpZi+Lc xLktyw/kTGkWfyu9gwERZ/IiAeKaTcbzhzl5ItG/ndsqCPDM81jmKnf6x678050+eJq/ +ZgA== X-Gm-Message-State: AOAM533shxIE9ry8HGnZCG7XhhVgUqzQiRaUqtuuK1SZZoWuVmV/5Dhh W6t/j1Jnh4yBab2URPPaQ3EROe7gdRBWRWcHGCBZ1A== X-Google-Smtp-Source: ABdhPJxFGt5Dntgj+qwGhvXaFOpnQvWG0jHZ1p4j/IHgmQmdfIUoMiD/D2bs8RfxGHBUeq0VHi5bSlkknn7IBqEisQo= X-Received: by 2002:a17:902:ccce:: with SMTP id z14mr1978185ple.34.1644277763021; Mon, 07 Feb 2022 15:49:23 -0800 (PST) MIME-Version: 1.0 References: <20220207063249.1833066-1-hch@lst.de> <20220207063249.1833066-7-hch@lst.de> In-Reply-To: <20220207063249.1833066-7-hch@lst.de> From: Dan Williams Date: Mon, 7 Feb 2022 15:49:12 -0800 Message-ID: To: Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Nouveau] [PATCH 6/8] mm: don't include in X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux NVDIMM , Ralph Campbell , Alistair Popple , Maling list - DRI developers , Linux MM , nouveau@lists.freedesktop.org, Felix Kuehling , "Pan, Xinhui" , Linux Kernel Mailing List , amd-gfx list , Jason Gunthorpe , Ben Skeggs , Alex Deucher , Andrew Morton , Logan Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > Move the check for the actual pgmap types that need the free at refcount > one behavior into the out of line helper, and thus avoid the need to > pull memremap.h into mm.h. Looks good to me assuming the compile bots agree. Reviewed-by: Dan Williams > > Signed-off-by: Christoph Hellwig > --- > arch/arm64/mm/mmu.c | 1 + > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + > drivers/gpu/drm/drm_cache.c | 2 +- > drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 + > drivers/gpu/drm/nouveau/nouveau_svm.c | 1 + > drivers/infiniband/core/rw.c | 1 + > drivers/nvdimm/pmem.h | 1 + > drivers/nvme/host/pci.c | 1 + > drivers/nvme/target/io-cmd-bdev.c | 1 + > fs/fuse/virtio_fs.c | 1 + > include/linux/memremap.h | 18 ++++++++++++++++++ > include/linux/mm.h | 20 -------------------- > lib/test_hmm.c | 1 + > mm/memremap.c | 6 +++++- > 14 files changed, 34 insertions(+), 22 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index acfae9b41cc8c9..580abae6c0b93f 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/= amdkfd/kfd_priv.h > index ea68f3b3a4e9cb..6d643b4b791d87 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > @@ -25,6 +25,7 @@ > > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c > index f19d9acbe95936..50b8a088f763a6 100644 > --- a/drivers/gpu/drm/drm_cache.c > +++ b/drivers/gpu/drm/drm_cache.c > @@ -27,11 +27,11 @@ > /* > * Authors: Thomas Hellstr=C3=B6m > */ > - > #include > #include > #include > #include > +#include > #include > > #include > diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nou= veau/nouveau_dmem.c > index e886a3b9e08c7d..a5cdfbe32b5e54 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c > @@ -39,6 +39,7 @@ > > #include > #include > +#include > #include > > /* > diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouv= eau/nouveau_svm.c > index 266809e511e2c1..090b9b47708cca 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_svm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > > struct nouveau_svm { > diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c > index 5a3bd41b331c93..4d98f931a13ddd 100644 > --- a/drivers/infiniband/core/rw.c > +++ b/drivers/infiniband/core/rw.c > @@ -2,6 +2,7 @@ > /* > * Copyright (c) 2016 HGST, a Western Digital Company. > */ > +#include > #include > #include > #include > diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h > index 59cfe13ea8a85c..1f51a23614299b 100644 > --- a/drivers/nvdimm/pmem.h > +++ b/drivers/nvdimm/pmem.h > @@ -3,6 +3,7 @@ > #define __NVDIMM_PMEM_H__ > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index 6a99ed68091589..ab15bc72710dbe 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-c= md-bdev.c > index 70ca9dfc1771a9..a141446db1bea3 100644 > --- a/drivers/nvme/target/io-cmd-bdev.c > +++ b/drivers/nvme/target/io-cmd-bdev.c > @@ -6,6 +6,7 @@ > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > #include > #include > +#include > #include > #include "nvmet.h" > > diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c > index 9d737904d07c0b..86b7dbb6a0d43e 100644 > --- a/fs/fuse/virtio_fs.c > +++ b/fs/fuse/virtio_fs.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/include/linux/memremap.h b/include/linux/memremap.h > index 1fafcc38acbad6..514ab46f597e5c 100644 > --- a/include/linux/memremap.h > +++ b/include/linux/memremap.h > @@ -1,6 +1,8 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #ifndef _LINUX_MEMREMAP_H_ > #define _LINUX_MEMREMAP_H_ > + > +#include > #include > #include > #include > @@ -129,6 +131,22 @@ static inline unsigned long pgmap_vmemmap_nr(struct = dev_pagemap *pgmap) > return 1 << pgmap->vmemmap_shift; > } > > +static inline bool is_device_private_page(const struct page *page) > +{ > + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > + IS_ENABLED(CONFIG_DEVICE_PRIVATE) && > + is_zone_device_page(page) && > + page->pgmap->type =3D=3D MEMORY_DEVICE_PRIVATE; > +} > + > +static inline bool is_pci_p2pdma_page(const struct page *page) > +{ > + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > + IS_ENABLED(CONFIG_PCI_P2PDMA) && > + is_zone_device_page(page) && > + page->pgmap->type =3D=3D MEMORY_DEVICE_PCI_P2PDMA; > +} > + > #ifdef CONFIG_ZONE_DEVICE > void *memremap_pages(struct dev_pagemap *pgmap, int nid); > void memunmap_pages(struct dev_pagemap *pgmap); > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 26baadcef4556b..80fccfe31c3444 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -23,7 +23,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1101,9 +1100,6 @@ static inline bool put_devmap_managed_page(struct p= age *page) > return false; > if (!is_zone_device_page(page)) > return false; > - if (page->pgmap->type !=3D MEMORY_DEVICE_PRIVATE && > - page->pgmap->type !=3D MEMORY_DEVICE_FS_DAX) > - return false; > return __put_devmap_managed_page(page); > } > > @@ -1114,22 +1110,6 @@ static inline bool put_devmap_managed_page(struct = page *page) > } > #endif /* CONFIG_DEV_PAGEMAP_OPS */ > > -static inline bool is_device_private_page(const struct page *page) > -{ > - return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > - IS_ENABLED(CONFIG_DEVICE_PRIVATE) && > - is_zone_device_page(page) && > - page->pgmap->type =3D=3D MEMORY_DEVICE_PRIVATE; > -} > - > -static inline bool is_pci_p2pdma_page(const struct page *page) > -{ > - return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > - IS_ENABLED(CONFIG_PCI_P2PDMA) && > - is_zone_device_page(page) && > - page->pgmap->type =3D=3D MEMORY_DEVICE_PCI_P2PDMA; > -} > - > /* 127: arbitrary random number, small enough to assemble well */ > #define folio_ref_zero_or_close_to_overflow(folio) \ > ((unsigned int) folio_ref_count(folio) + 127u <=3D 127u) > diff --git a/lib/test_hmm.c b/lib/test_hmm.c > index 396beee6b061d4..e5fc14ba71f33e 100644 > --- a/lib/test_hmm.c > +++ b/lib/test_hmm.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/mm/memremap.c b/mm/memremap.c > index f41233a67edb12..a0ece2344c2cab 100644 > --- a/mm/memremap.c > +++ b/mm/memremap.c > @@ -4,7 +4,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > @@ -504,6 +504,10 @@ void free_devmap_managed_page(struct page *page) > > bool __put_devmap_managed_page(struct page *page) > { > + if (page->pgmap->type !=3D MEMORY_DEVICE_PRIVATE && > + page->pgmap->type !=3D MEMORY_DEVICE_FS_DAX) > + return false; > + > /* > * devmap page refcounts are 1-based, rather than 0-based: if > * refcount is 1, then the page is free and the refcount is > -- > 2.30.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E840C433F5 for ; Mon, 7 Feb 2022 23:49:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C6A810E460; Mon, 7 Feb 2022 23:49:25 +0000 (UTC) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E87C10E162 for ; Mon, 7 Feb 2022 23:49:23 +0000 (UTC) Received: by mail-pj1-x1030.google.com with SMTP id ki18-20020a17090ae91200b001b8be87e9abso374941pjb.1 for ; Mon, 07 Feb 2022 15:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=srqNW1EcIXWSL3YA9DB/cq+5wKzOkrj3L8GZFZFPp88=; b=01MLVSpGJcOLNshddxkhtSXXihKsoNqdx5vMNxTFv6bN6BYo1SzUvt/9GrJao02HnF Hb+sjT0ujjyEhZBcYaEd66uhrH2U82Bpll97CF5ng/E4ARrZPgn+43XxHckYHlvbZ2cV f+jtU4mZKMkJCdUAiiqidQXrgC4Uo9dYltnKCJah1zHCywOpfDTIJzzdLCdSte1qGkst 3TMcL8koigGPS26Czk0t/YynCFMadqyzQa7PlOBrn/XujPHTtuWh/oT8H0p3MLl7Uhro o0Gdsh8bSiaHc0CBUQxnZNfGeQPOMJTi12vYqWQkg/+GUCDwEzHRF9C80zL1n7F4WwGt uBog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=srqNW1EcIXWSL3YA9DB/cq+5wKzOkrj3L8GZFZFPp88=; b=G1qopfzg3ItMGOHoC58Fg81srGZ/l0/XO2XmakX0FoLgWk0hji3tjhTZZ5S3PEcfLn zmTA1Nk+9oicVs2jTKo0fhh/gxntcmmQcVBZpvSelqpTgQLh608oUrKiwKcKsG8R5Tat J+7134+YCLm5g1BLXGtOHT+1M9jL905eJ2n0KtviN7GOiTd4G4D/+FB6OpVjZio7Q95l eWdN3HF4jqOohk6RL/uNw/MJ0AQYyWWj5H0CBTz5ftCBhv3ZcfQEF/XRLGgLhMCKY+Qe JApZIRj0ojkE+aq5cZVAsMxEmoCgcI524ow5GsTXt9zZzO04QMBQV69hszAnyrlcYq2O 85ig== X-Gm-Message-State: AOAM531sBZpYZW7dK5ZzPmif/0MFIJkolAS2rd/pVpRELySsmo6nEMkm KQm6bhImObzt/J5LnO/dD5rCjrm0CeVGOoElGL2xGw== X-Google-Smtp-Source: ABdhPJxFGt5Dntgj+qwGhvXaFOpnQvWG0jHZ1p4j/IHgmQmdfIUoMiD/D2bs8RfxGHBUeq0VHi5bSlkknn7IBqEisQo= X-Received: by 2002:a17:902:ccce:: with SMTP id z14mr1978185ple.34.1644277763021; Mon, 07 Feb 2022 15:49:23 -0800 (PST) MIME-Version: 1.0 References: <20220207063249.1833066-1-hch@lst.de> <20220207063249.1833066-7-hch@lst.de> In-Reply-To: <20220207063249.1833066-7-hch@lst.de> From: Dan Williams Date: Mon, 7 Feb 2022 15:49:12 -0800 Message-ID: Subject: Re: [PATCH 6/8] mm: don't include in To: Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux NVDIMM , Ralph Campbell , Alistair Popple , Maling list - DRI developers , Karol Herbst , Linux MM , nouveau@lists.freedesktop.org, Felix Kuehling , "Pan, Xinhui" , Linux Kernel Mailing List , amd-gfx list , Jason Gunthorpe , Ben Skeggs , Alex Deucher , Andrew Morton , Logan Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sun, Feb 6, 2022 at 10:33 PM Christoph Hellwig wrote: > > Move the check for the actual pgmap types that need the free at refcount > one behavior into the out of line helper, and thus avoid the need to > pull memremap.h into mm.h. Looks good to me assuming the compile bots agree. Reviewed-by: Dan Williams > > Signed-off-by: Christoph Hellwig > --- > arch/arm64/mm/mmu.c | 1 + > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + > drivers/gpu/drm/drm_cache.c | 2 +- > drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 + > drivers/gpu/drm/nouveau/nouveau_svm.c | 1 + > drivers/infiniband/core/rw.c | 1 + > drivers/nvdimm/pmem.h | 1 + > drivers/nvme/host/pci.c | 1 + > drivers/nvme/target/io-cmd-bdev.c | 1 + > fs/fuse/virtio_fs.c | 1 + > include/linux/memremap.h | 18 ++++++++++++++++++ > include/linux/mm.h | 20 -------------------- > lib/test_hmm.c | 1 + > mm/memremap.c | 6 +++++- > 14 files changed, 34 insertions(+), 22 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index acfae9b41cc8c9..580abae6c0b93f 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/= amdkfd/kfd_priv.h > index ea68f3b3a4e9cb..6d643b4b791d87 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > @@ -25,6 +25,7 @@ > > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c > index f19d9acbe95936..50b8a088f763a6 100644 > --- a/drivers/gpu/drm/drm_cache.c > +++ b/drivers/gpu/drm/drm_cache.c > @@ -27,11 +27,11 @@ > /* > * Authors: Thomas Hellstr=C3=B6m > */ > - > #include > #include > #include > #include > +#include > #include > > #include > diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nou= veau/nouveau_dmem.c > index e886a3b9e08c7d..a5cdfbe32b5e54 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c > @@ -39,6 +39,7 @@ > > #include > #include > +#include > #include > > /* > diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouv= eau/nouveau_svm.c > index 266809e511e2c1..090b9b47708cca 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_svm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > > struct nouveau_svm { > diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c > index 5a3bd41b331c93..4d98f931a13ddd 100644 > --- a/drivers/infiniband/core/rw.c > +++ b/drivers/infiniband/core/rw.c > @@ -2,6 +2,7 @@ > /* > * Copyright (c) 2016 HGST, a Western Digital Company. > */ > +#include > #include > #include > #include > diff --git a/drivers/nvdimm/pmem.h b/drivers/nvdimm/pmem.h > index 59cfe13ea8a85c..1f51a23614299b 100644 > --- a/drivers/nvdimm/pmem.h > +++ b/drivers/nvdimm/pmem.h > @@ -3,6 +3,7 @@ > #define __NVDIMM_PMEM_H__ > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index 6a99ed68091589..ab15bc72710dbe 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-c= md-bdev.c > index 70ca9dfc1771a9..a141446db1bea3 100644 > --- a/drivers/nvme/target/io-cmd-bdev.c > +++ b/drivers/nvme/target/io-cmd-bdev.c > @@ -6,6 +6,7 @@ > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > #include > #include > +#include > #include > #include "nvmet.h" > > diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c > index 9d737904d07c0b..86b7dbb6a0d43e 100644 > --- a/fs/fuse/virtio_fs.c > +++ b/fs/fuse/virtio_fs.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/include/linux/memremap.h b/include/linux/memremap.h > index 1fafcc38acbad6..514ab46f597e5c 100644 > --- a/include/linux/memremap.h > +++ b/include/linux/memremap.h > @@ -1,6 +1,8 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #ifndef _LINUX_MEMREMAP_H_ > #define _LINUX_MEMREMAP_H_ > + > +#include > #include > #include > #include > @@ -129,6 +131,22 @@ static inline unsigned long pgmap_vmemmap_nr(struct = dev_pagemap *pgmap) > return 1 << pgmap->vmemmap_shift; > } > > +static inline bool is_device_private_page(const struct page *page) > +{ > + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > + IS_ENABLED(CONFIG_DEVICE_PRIVATE) && > + is_zone_device_page(page) && > + page->pgmap->type =3D=3D MEMORY_DEVICE_PRIVATE; > +} > + > +static inline bool is_pci_p2pdma_page(const struct page *page) > +{ > + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > + IS_ENABLED(CONFIG_PCI_P2PDMA) && > + is_zone_device_page(page) && > + page->pgmap->type =3D=3D MEMORY_DEVICE_PCI_P2PDMA; > +} > + > #ifdef CONFIG_ZONE_DEVICE > void *memremap_pages(struct dev_pagemap *pgmap, int nid); > void memunmap_pages(struct dev_pagemap *pgmap); > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 26baadcef4556b..80fccfe31c3444 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -23,7 +23,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -1101,9 +1100,6 @@ static inline bool put_devmap_managed_page(struct p= age *page) > return false; > if (!is_zone_device_page(page)) > return false; > - if (page->pgmap->type !=3D MEMORY_DEVICE_PRIVATE && > - page->pgmap->type !=3D MEMORY_DEVICE_FS_DAX) > - return false; > return __put_devmap_managed_page(page); > } > > @@ -1114,22 +1110,6 @@ static inline bool put_devmap_managed_page(struct = page *page) > } > #endif /* CONFIG_DEV_PAGEMAP_OPS */ > > -static inline bool is_device_private_page(const struct page *page) > -{ > - return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > - IS_ENABLED(CONFIG_DEVICE_PRIVATE) && > - is_zone_device_page(page) && > - page->pgmap->type =3D=3D MEMORY_DEVICE_PRIVATE; > -} > - > -static inline bool is_pci_p2pdma_page(const struct page *page) > -{ > - return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && > - IS_ENABLED(CONFIG_PCI_P2PDMA) && > - is_zone_device_page(page) && > - page->pgmap->type =3D=3D MEMORY_DEVICE_PCI_P2PDMA; > -} > - > /* 127: arbitrary random number, small enough to assemble well */ > #define folio_ref_zero_or_close_to_overflow(folio) \ > ((unsigned int) folio_ref_count(folio) + 127u <=3D 127u) > diff --git a/lib/test_hmm.c b/lib/test_hmm.c > index 396beee6b061d4..e5fc14ba71f33e 100644 > --- a/lib/test_hmm.c > +++ b/lib/test_hmm.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/mm/memremap.c b/mm/memremap.c > index f41233a67edb12..a0ece2344c2cab 100644 > --- a/mm/memremap.c > +++ b/mm/memremap.c > @@ -4,7 +4,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > @@ -504,6 +504,10 @@ void free_devmap_managed_page(struct page *page) > > bool __put_devmap_managed_page(struct page *page) > { > + if (page->pgmap->type !=3D MEMORY_DEVICE_PRIVATE && > + page->pgmap->type !=3D MEMORY_DEVICE_FS_DAX) > + return false; > + > /* > * devmap page refcounts are 1-based, rather than 0-based: if > * refcount is 1, then the page is free and the refcount is > -- > 2.30.2 >