Message ID | 20201104023213.760-1-xiaofeng.yan2012@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2,xarry] :Fixed an issue with memory allocated using the GFP_KERNEL flag in spinlocks | expand |
On Wed, Nov 04, 2020 at 10:32:12AM +0800, xiaofeng.yan wrote: > xa_lock_irq(xa); > - curr = __xa_store(xa, index, entry, gfp); > + curr = __xa_store(xa, index, entry, GFP_ATOMIC); > xa_unlock_irq(xa); You haven't actually seen a bug, have you? You just read the code wrongly. void *__xa_store(struct xarray *xa, unsigned long index, void *entry, gfp_t gfp) ... } while (__xas_nomem(&xas, gfp)); ... if (gfpflags_allow_blocking(gfp)) { xas_unlock_type(xas, lock_type); xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); xas_lock_type(xas, lock_type);
diff --git a/include/linux/xarray.h b/include/linux/xarray.h index 92c0160b3352..aeaf97d5642f 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -595,7 +595,6 @@ static inline void *xa_store_bh(struct xarray *xa, unsigned long index, * @xa: XArray. * @index: Index into array. * @entry: New entry. - * @gfp: Memory allocation flags. * * This function is like calling xa_store() except it disables interrupts * while holding the array lock. @@ -605,12 +604,12 @@ static inline void *xa_store_bh(struct xarray *xa, unsigned long index, * Return: The old entry at this index or xa_err() if an error happened. */ static inline void *xa_store_irq(struct xarray *xa, unsigned long index, - void *entry, gfp_t gfp) + void *entry) { void *curr; xa_lock_irq(xa); - curr = __xa_store(xa, index, entry, gfp); + curr = __xa_store(xa, index, entry, GFP_ATOMIC); xa_unlock_irq(xa); return curr;