mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
linux/kmem: remove HAVE_ATOMIC64_T and kmem_alloc_used wrappers
Seems like we haven't set it since the SPL was pulled into the main ZFS tree. In removing the define, I've taken the 64-bit version (ie the one that _hasn't_ been running since back then) because it looks like its closer to the intended width by the way its used. Since the macros ar eno longer needed as a selector, pull those too. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Sponsored-by: https://despairlabs.com/sponsor/ Closes #17551
This commit is contained in:
committed by
Brian Behlendorf
parent
1c483cf3d0
commit
9292071565
@@ -302,13 +302,8 @@ spl_kmem_free_impl(const void *buf, size_t size)
|
||||
#ifdef DEBUG_KMEM
|
||||
|
||||
/* Shim layer memory accounting */
|
||||
#ifdef HAVE_ATOMIC64_T
|
||||
atomic64_t kmem_alloc_used = ATOMIC64_INIT(0);
|
||||
unsigned long long kmem_alloc_max = 0;
|
||||
#else /* HAVE_ATOMIC64_T */
|
||||
atomic_t kmem_alloc_used = ATOMIC_INIT(0);
|
||||
unsigned long long kmem_alloc_max = 0;
|
||||
#endif /* HAVE_ATOMIC64_T */
|
||||
uint64_t kmem_alloc_max = 0;
|
||||
|
||||
EXPORT_SYMBOL(kmem_alloc_used);
|
||||
EXPORT_SYMBOL(kmem_alloc_max);
|
||||
@@ -320,9 +315,9 @@ spl_kmem_alloc_debug(size_t size, int flags, int node)
|
||||
|
||||
ptr = spl_kmem_alloc_impl(size, flags, node);
|
||||
if (ptr) {
|
||||
kmem_alloc_used_add(size);
|
||||
if (unlikely(kmem_alloc_used_read() > kmem_alloc_max))
|
||||
kmem_alloc_max = kmem_alloc_used_read();
|
||||
atomic64_add(size, &kmem_alloc_used);
|
||||
if (unlikely(atomic64_read(&kmem_alloc_used) > kmem_alloc_max))
|
||||
kmem_alloc_max = atomic64_read(&kmem_alloc_used);
|
||||
}
|
||||
|
||||
return (ptr);
|
||||
@@ -331,7 +326,7 @@ spl_kmem_alloc_debug(size_t size, int flags, int node)
|
||||
inline void
|
||||
spl_kmem_free_debug(const void *ptr, size_t size)
|
||||
{
|
||||
kmem_alloc_used_sub(size);
|
||||
atomic64_sub(size, &kmem_alloc_used);
|
||||
spl_kmem_free_impl(ptr, size);
|
||||
}
|
||||
|
||||
@@ -595,7 +590,7 @@ spl_kmem_init(void)
|
||||
{
|
||||
|
||||
#ifdef DEBUG_KMEM
|
||||
kmem_alloc_used_set(0);
|
||||
atomic64_set(&kmem_alloc_used, 0);
|
||||
|
||||
|
||||
|
||||
@@ -617,9 +612,10 @@ spl_kmem_fini(void)
|
||||
* at that address to aid in debugging. Performance is not
|
||||
* a serious concern here since it is module unload time.
|
||||
*/
|
||||
if (kmem_alloc_used_read() != 0)
|
||||
if (atomic64_read(&kmem_alloc_used) != 0)
|
||||
printk(KERN_WARNING "kmem leaked %ld/%llu bytes\n",
|
||||
(unsigned long)kmem_alloc_used_read(), kmem_alloc_max);
|
||||
(unsigned long)atomic64_read(&kmem_alloc_used),
|
||||
kmem_alloc_max);
|
||||
|
||||
#ifdef DEBUG_KMEM_TRACKING
|
||||
spl_kmem_fini_tracking(&kmem_list, &kmem_lock);
|
||||
|
||||
@@ -82,11 +82,7 @@ proc_domemused(CONST_CTL_TABLE *table, int write,
|
||||
if (write) {
|
||||
*ppos += *lenp;
|
||||
} else {
|
||||
#ifdef HAVE_ATOMIC64_T
|
||||
val = atomic64_read((atomic64_t *)table->data);
|
||||
#else
|
||||
val = atomic_read((atomic_t *)table->data);
|
||||
#endif /* HAVE_ATOMIC64_T */
|
||||
rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos);
|
||||
}
|
||||
|
||||
@@ -315,18 +311,14 @@ static struct ctl_table spl_kmem_table[] = {
|
||||
{
|
||||
.procname = "kmem_used",
|
||||
.data = &kmem_alloc_used,
|
||||
#ifdef HAVE_ATOMIC64_T
|
||||
.maxlen = sizeof (atomic64_t),
|
||||
#else
|
||||
.maxlen = sizeof (atomic_t),
|
||||
#endif /* HAVE_ATOMIC64_T */
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_domemused,
|
||||
},
|
||||
{
|
||||
.procname = "kmem_max",
|
||||
.data = &kmem_alloc_max,
|
||||
.maxlen = sizeof (unsigned long),
|
||||
.maxlen = sizeof (uint64_t),
|
||||
.extra1 = &table_min,
|
||||
.extra2 = &table_max,
|
||||
.mode = 0444,
|
||||
|
||||
Reference in New Issue
Block a user