Message ID | 20190626122724.13313-4-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | [01/25] mm: remove the unused ARCH_HAS_HMM_DEVICE Kconfig option | expand |
On Wed, Jun 26, 2019 at 02:27:02PM +0200, Christoph Hellwig wrote: > This function has never been used since it was first added to the kernel > more than a year and a half ago, and if we ever grow a consumer of the > MEMORY_DEVICE_PUBLIC infrastructure it can easily use devm_memremap_pages > directly. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> > Reviewed-by: John Hubbard <jhubbard@nvidia.com> > Acked-by: Michal Hocko <mhocko@suse.com> > --- > include/linux/hmm.h | 3 --- > mm/hmm.c | 50 --------------------------------------------- > 2 files changed, 53 deletions(-) This should be squashed to the new earlier patch? Jason
On Thu, Jun 27, 2019 at 04:18:22PM +0000, Jason Gunthorpe wrote: > On Wed, Jun 26, 2019 at 02:27:02PM +0200, Christoph Hellwig wrote: > > This function has never been used since it was first added to the kernel > > more than a year and a half ago, and if we ever grow a consumer of the > > MEMORY_DEVICE_PUBLIC infrastructure it can easily use devm_memremap_pages > > directly. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> > > Reviewed-by: John Hubbard <jhubbard@nvidia.com> > > Acked-by: Michal Hocko <mhocko@suse.com> > > --- > > include/linux/hmm.h | 3 --- > > mm/hmm.c | 50 --------------------------------------------- > > 2 files changed, 53 deletions(-) > > This should be squashed to the new earlier patch? We could do that. Do you just want to do that when you apply it?
diff --git a/include/linux/hmm.h b/include/linux/hmm.h index 99765be3284d..5c46b0f603fd 100644 --- a/include/linux/hmm.h +++ b/include/linux/hmm.h @@ -722,9 +722,6 @@ struct hmm_devmem { struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops, struct device *device, unsigned long size); -struct hmm_devmem *hmm_devmem_add_resource(const struct hmm_devmem_ops *ops, - struct device *device, - struct resource *res); /* * hmm_devmem_page_set_drvdata - set per-page driver data field diff --git a/mm/hmm.c b/mm/hmm.c index 00cc642b3d7e..bd260a3b6b09 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -1478,54 +1478,4 @@ struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops, return devmem; } EXPORT_SYMBOL_GPL(hmm_devmem_add); - -struct hmm_devmem *hmm_devmem_add_resource(const struct hmm_devmem_ops *ops, - struct device *device, - struct resource *res) -{ - struct hmm_devmem *devmem; - void *result; - int ret; - - if (res->desc != IORES_DESC_DEVICE_PUBLIC_MEMORY) - return ERR_PTR(-EINVAL); - - dev_pagemap_get_ops(); - - devmem = devm_kzalloc(device, sizeof(*devmem), GFP_KERNEL); - if (!devmem) - return ERR_PTR(-ENOMEM); - - init_completion(&devmem->completion); - devmem->pfn_first = -1UL; - devmem->pfn_last = -1UL; - devmem->resource = res; - devmem->device = device; - devmem->ops = ops; - - ret = percpu_ref_init(&devmem->ref, &hmm_devmem_ref_release, - 0, GFP_KERNEL); - if (ret) - return ERR_PTR(ret); - - devmem->pfn_first = devmem->resource->start >> PAGE_SHIFT; - devmem->pfn_last = devmem->pfn_first + - (resource_size(devmem->resource) >> PAGE_SHIFT); - devmem->page_fault = hmm_devmem_fault; - - devmem->pagemap.type = MEMORY_DEVICE_PUBLIC; - devmem->pagemap.res = *devmem->resource; - devmem->pagemap.page_free = hmm_devmem_free; - devmem->pagemap.altmap_valid = false; - devmem->pagemap.ref = &devmem->ref; - devmem->pagemap.data = devmem; - devmem->pagemap.kill = hmm_devmem_ref_kill; - devmem->pagemap.cleanup = hmm_devmem_ref_exit; - - result = devm_memremap_pages(devmem->device, &devmem->pagemap); - if (IS_ERR(result)) - return result; - return devmem; -} -EXPORT_SYMBOL_GPL(hmm_devmem_add_resource); #endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */