aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/devres.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-10 15:07:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-10 15:07:22 -0500
commit264015f8a83fefc62c5125d761fbbadf924e520c (patch)
tree6a0602761abb3d866471861a7128a5177a855fd0 /drivers/base/devres.c
parentd55fc37856244c929965c190c8e9dcb49e2c07aa (diff)
parentab27a8d04b32b6ee8c30c14c4afd1058e8addc82 (diff)
Merge tag 'libnvdimm-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Dan Williams: "Outside of the new ACPI-NFIT hot-add support this pull request is more notable for what it does not contain, than what it does. There were a handful of development topics this cycle, dax get_user_pages, dax fsync, and raw block dax, that need more more iteration and will wait for 4.5. The patches to make devm and the pmem driver NUMA aware have been in -next for several weeks. The hot-add support has not, but is contained to the NFIT driver and is passing unit tests. The coredump support is straightforward and was looked over by Jeff. All of it has received a 0day build success notification across 107 configs. Summary: - Add support for the ACPI 6.0 NFIT hot add mechanism to process updates of the NFIT at runtime. - Teach the coredump implementation how to filter out DAX mappings. - Introduce NUMA hints for allocations made by the pmem driver, and as a side effect all devm allocations now hint their NUMA node by default" * tag 'libnvdimm-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: coredump: add DAX filtering for FDPIC ELF coredumps coredump: add DAX filtering for ELF coredumps acpi: nfit: Add support for hot-add nfit: in acpi_nfit_init, break on a 0-length table pmem, memremap: convert to numa aware allocations devm_memremap_pages: use numa_mem_id devm: make allocations numa aware by default devm_memremap: convert to return ERR_PTR devm_memunmap: use devres_release() pmem: kill memremap_pmem() x86, mm: quiet arch_add_memory()
Diffstat (limited to 'drivers/base/devres.c')
-rw-r--r--drivers/base/devres.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 875464690117..8fc654f0807b 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -82,12 +82,12 @@ static struct devres_group * node_to_group(struct devres_node *node)
82} 82}
83 83
84static __always_inline struct devres * alloc_dr(dr_release_t release, 84static __always_inline struct devres * alloc_dr(dr_release_t release,
85 size_t size, gfp_t gfp) 85 size_t size, gfp_t gfp, int nid)
86{ 86{
87 size_t tot_size = sizeof(struct devres) + size; 87 size_t tot_size = sizeof(struct devres) + size;
88 struct devres *dr; 88 struct devres *dr;
89 89
90 dr = kmalloc_track_caller(tot_size, gfp); 90 dr = kmalloc_node_track_caller(tot_size, gfp, nid);
91 if (unlikely(!dr)) 91 if (unlikely(!dr))
92 return NULL; 92 return NULL;
93 93
@@ -106,24 +106,25 @@ static void add_dr(struct device *dev, struct devres_node *node)
106} 106}
107 107
108#ifdef CONFIG_DEBUG_DEVRES 108#ifdef CONFIG_DEBUG_DEVRES
109void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, 109void * __devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, int nid,
110 const char *name) 110 const char *name)
111{ 111{
112 struct devres *dr; 112 struct devres *dr;
113 113
114 dr = alloc_dr(release, size, gfp | __GFP_ZERO); 114 dr = alloc_dr(release, size, gfp | __GFP_ZERO, nid);
115 if (unlikely(!dr)) 115 if (unlikely(!dr))
116 return NULL; 116 return NULL;
117 set_node_dbginfo(&dr->node, name, size); 117 set_node_dbginfo(&dr->node, name, size);
118 return dr->data; 118 return dr->data;
119} 119}
120EXPORT_SYMBOL_GPL(__devres_alloc); 120EXPORT_SYMBOL_GPL(__devres_alloc_node);
121#else 121#else
122/** 122/**
123 * devres_alloc - Allocate device resource data 123 * devres_alloc - Allocate device resource data
124 * @release: Release function devres will be associated with 124 * @release: Release function devres will be associated with
125 * @size: Allocation size 125 * @size: Allocation size
126 * @gfp: Allocation flags 126 * @gfp: Allocation flags
127 * @nid: NUMA node
127 * 128 *
128 * Allocate devres of @size bytes. The allocated area is zeroed, then 129 * Allocate devres of @size bytes. The allocated area is zeroed, then
129 * associated with @release. The returned pointer can be passed to 130 * associated with @release. The returned pointer can be passed to
@@ -132,16 +133,16 @@ EXPORT_SYMBOL_GPL(__devres_alloc);
132 * RETURNS: 133 * RETURNS:
133 * Pointer to allocated devres on success, NULL on failure. 134 * Pointer to allocated devres on success, NULL on failure.
134 */ 135 */
135void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp) 136void * devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, int nid)
136{ 137{
137 struct devres *dr; 138 struct devres *dr;
138 139
139 dr = alloc_dr(release, size, gfp | __GFP_ZERO); 140 dr = alloc_dr(release, size, gfp | __GFP_ZERO, nid);
140 if (unlikely(!dr)) 141 if (unlikely(!dr))
141 return NULL; 142 return NULL;
142 return dr->data; 143 return dr->data;
143} 144}
144EXPORT_SYMBOL_GPL(devres_alloc); 145EXPORT_SYMBOL_GPL(devres_alloc_node);
145#endif 146#endif
146 147
147/** 148/**
@@ -776,7 +777,7 @@ void * devm_kmalloc(struct device *dev, size_t size, gfp_t gfp)
776 struct devres *dr; 777 struct devres *dr;
777 778
778 /* use raw alloc_dr for kmalloc caller tracing */ 779 /* use raw alloc_dr for kmalloc caller tracing */
779 dr = alloc_dr(devm_kmalloc_release, size, gfp); 780 dr = alloc_dr(devm_kmalloc_release, size, gfp, dev_to_node(dev));
780 if (unlikely(!dr)) 781 if (unlikely(!dr))
781 return NULL; 782 return NULL;
782 783