From: Dan Williams <dan.j.williams@intel.com> To: tj@kernel.org Cc: linux-nvdimm@lists.01.org, hch@lst.de, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] pmem, memremap: convert to numa aware allocations Date: Fri, 25 Sep 2015 21:17:53 -0400 [thread overview] Message-ID: <20150926011753.2848.75637.stgit@dwillia2-desk3.jf.intel.com> (raw) In-Reply-To: <20150926011243.2848.82422.stgit@dwillia2-desk3.jf.intel.com> Given that pmem ranges come with numa-locality hints, arrange for the resulting driver objects to be obtained from node-local memory. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/nvdimm/pmem.c | 5 +++-- kernel/memremap.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index b9525385c0dc..570764a7599e 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -177,9 +177,10 @@ static void pmem_detach_disk(struct pmem_device *pmem) static int pmem_attach_disk(struct device *dev, struct nd_namespace_common *ndns, struct pmem_device *pmem) { + int nid = dev_to_node(dev); struct gendisk *disk; - pmem->pmem_queue = blk_alloc_queue(GFP_KERNEL); + pmem->pmem_queue = blk_alloc_queue_node(GFP_KERNEL, nid); if (!pmem->pmem_queue) return -ENOMEM; @@ -189,7 +190,7 @@ static int pmem_attach_disk(struct device *dev, blk_queue_bounce_limit(pmem->pmem_queue, BLK_BOUNCE_ANY); queue_flag_set_unlocked(QUEUE_FLAG_NONROT, pmem->pmem_queue); - disk = alloc_disk(0); + disk = alloc_disk_node(0, nid); if (!disk) { blk_cleanup_queue(pmem->pmem_queue); return -ENOMEM; diff --git a/kernel/memremap.c b/kernel/memremap.c index 86a5cdeb18f2..f257c4e66e60 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -114,7 +114,8 @@ void *devm_memremap(struct device *dev, resource_size_t offset, { void **ptr, *addr; - ptr = devres_alloc(devm_memremap_release, sizeof(*ptr), GFP_KERNEL); + ptr = devres_alloc_node(devm_memremap_release, sizeof(*ptr), GFP_KERNEL, + dev_to_node(dev)); if (!ptr) return NULL; @@ -166,8 +167,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res) if (is_ram == REGION_INTERSECTS) return __va(res->start); - page_map = devres_alloc(devm_memremap_pages_release, - sizeof(*page_map), GFP_KERNEL); + page_map = devres_alloc_node(devm_memremap_pages_release, + sizeof(*page_map), GFP_KERNEL, dev_to_node(dev)); if (!page_map) return ERR_PTR(-ENOMEM);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Williams <dan.j.williams@intel.com> To: tj@kernel.org Cc: linux-nvdimm@ml01.01.org, hch@lst.de, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] pmem, memremap: convert to numa aware allocations Date: Fri, 25 Sep 2015 21:17:53 -0400 [thread overview] Message-ID: <20150926011753.2848.75637.stgit@dwillia2-desk3.jf.intel.com> (raw) In-Reply-To: <20150926011243.2848.82422.stgit@dwillia2-desk3.jf.intel.com> Given that pmem ranges come with numa-locality hints, arrange for the resulting driver objects to be obtained from node-local memory. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/nvdimm/pmem.c | 5 +++-- kernel/memremap.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index b9525385c0dc..570764a7599e 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -177,9 +177,10 @@ static void pmem_detach_disk(struct pmem_device *pmem) static int pmem_attach_disk(struct device *dev, struct nd_namespace_common *ndns, struct pmem_device *pmem) { + int nid = dev_to_node(dev); struct gendisk *disk; - pmem->pmem_queue = blk_alloc_queue(GFP_KERNEL); + pmem->pmem_queue = blk_alloc_queue_node(GFP_KERNEL, nid); if (!pmem->pmem_queue) return -ENOMEM; @@ -189,7 +190,7 @@ static int pmem_attach_disk(struct device *dev, blk_queue_bounce_limit(pmem->pmem_queue, BLK_BOUNCE_ANY); queue_flag_set_unlocked(QUEUE_FLAG_NONROT, pmem->pmem_queue); - disk = alloc_disk(0); + disk = alloc_disk_node(0, nid); if (!disk) { blk_cleanup_queue(pmem->pmem_queue); return -ENOMEM; diff --git a/kernel/memremap.c b/kernel/memremap.c index 86a5cdeb18f2..f257c4e66e60 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -114,7 +114,8 @@ void *devm_memremap(struct device *dev, resource_size_t offset, { void **ptr, *addr; - ptr = devres_alloc(devm_memremap_release, sizeof(*ptr), GFP_KERNEL); + ptr = devres_alloc_node(devm_memremap_release, sizeof(*ptr), GFP_KERNEL, + dev_to_node(dev)); if (!ptr) return NULL; @@ -166,8 +167,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res) if (is_ram == REGION_INTERSECTS) return __va(res->start); - page_map = devres_alloc(devm_memremap_pages_release, - sizeof(*page_map), GFP_KERNEL); + page_map = devres_alloc_node(devm_memremap_pages_release, + sizeof(*page_map), GFP_KERNEL, dev_to_node(dev)); if (!page_map) return ERR_PTR(-ENOMEM);
next prev parent reply other threads:[~2015-09-26 1:17 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-26 1:17 [PATCH 0/3] numa allocations for devm and pmem Dan Williams 2015-09-26 1:17 ` Dan Williams 2015-09-26 1:17 ` [PATCH 1/3] devm: make allocations numa aware by default Dan Williams 2015-09-26 1:17 ` Dan Williams 2015-09-30 0:30 ` Dan Williams 2015-09-30 0:30 ` Dan Williams 2015-09-30 21:40 ` Tejun Heo 2015-09-30 21:40 ` Tejun Heo 2015-09-26 1:17 ` [PATCH 2/3] devm_memremap_pages: use numa_mem_id Dan Williams 2015-09-26 1:17 ` Dan Williams 2015-09-26 1:17 ` Dan Williams [this message] 2015-09-26 1:17 ` [PATCH 3/3] pmem, memremap: convert to numa aware allocations Dan Williams 2015-10-04 6:40 ` [PATCH 0/3] numa allocations for devm and pmem Christoph Hellwig 2015-10-04 6:40 ` Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20150926011753.2848.75637.stgit@dwillia2-desk3.jf.intel.com \ --to=dan.j.williams@intel.com \ --cc=hch@lst.de \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvdimm@lists.01.org \ --cc=tj@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.