diff options
author | Dmitry Eremin <dmitry.eremin@intel.com> | 2015-07-06 12:48:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-13 19:47:20 -0700 |
commit | 323b0b2c1e57d3c089473d755ff9a001d1a6bc8f (patch) | |
tree | bf312124bbf70fe5c62d27e1ff4d383b54205f7a | |
parent | 8710427dd68f4dff8976d221e220317cea20ecec (diff) |
staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams
/proc/sys/lnet/lnet_memused
Remove memory tracking for LNet.
Remove redundant enums definition.
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 files changed, 9 insertions, 112 deletions
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index ed37d26eb20d..9544860e3292 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -87,24 +87,6 @@ do { \ lbug_with_loc(&msgdata); \ } while (0) -extern atomic_t libcfs_kmemory; -/* - * Memory - */ - -# define libcfs_kmem_inc(ptr, size) \ -do { \ - atomic_add(size, &libcfs_kmemory); \ -} while (0) - -# define libcfs_kmem_dec(ptr, size) \ -do { \ - atomic_sub(size, &libcfs_kmemory); \ -} while (0) - -# define libcfs_kmem_read() \ - atomic_read(&libcfs_kmemory) - #ifndef LIBCFS_VMALLOC_SIZE #define LIBCFS_VMALLOC_SIZE (2 << PAGE_CACHE_SHIFT) /* 2 pages */ #endif @@ -121,14 +103,9 @@ do { \ if (unlikely((ptr) == NULL)) { \ CERROR("LNET: out of memory at %s:%d (tried to alloc '" \ #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \ - CERROR("LNET: %d total bytes allocated by lnet\n", \ - libcfs_kmem_read()); \ } else { \ memset((ptr), 0, (size)); \ - libcfs_kmem_inc((ptr), (size)); \ - CDEBUG(D_MALLOC, "alloc '" #ptr "': %d at %p (tot %d).\n", \ - (int)(size), (ptr), libcfs_kmem_read()); \ - } \ + } \ } while (0) /** @@ -180,9 +157,6 @@ do { \ "%s:%d\n", s, __FILE__, __LINE__); \ break; \ } \ - libcfs_kmem_dec((ptr), s); \ - CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \ - s, (ptr), libcfs_kmem_read()); \ if (unlikely(s > LIBCFS_VMALLOC_SIZE)) \ vfree(ptr); \ else \ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 4eb24a11b02a..f429d25306c1 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2667,9 +2667,6 @@ static void kiblnd_base_shutdown(void) LASSERT(list_empty(&kiblnd_data.kib_devs)); - CDEBUG(D_MALLOC, "before LND base cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - switch (kiblnd_data.kib_init) { default: LBUG(); @@ -2720,9 +2717,6 @@ static void kiblnd_base_shutdown(void) if (kiblnd_data.kib_scheds != NULL) cfs_percpt_free(kiblnd_data.kib_scheds); - CDEBUG(D_MALLOC, "after LND base cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - kiblnd_data.kib_init = IBLND_INIT_NOTHING; module_put(THIS_MODULE); } @@ -2739,9 +2733,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) if (net == NULL) goto out; - CDEBUG(D_MALLOC, "before LND net cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - write_lock_irqsave(g_lock, flags); net->ibn_shutdown = 1; write_unlock_irqrestore(g_lock, flags); @@ -2786,9 +2777,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) break; } - CDEBUG(D_MALLOC, "after LND net cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - net->ibn_init = IBLND_INIT_NOTHING; ni->ni_data = NULL; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 4128a92218a9..d8bfcadd184a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -2252,8 +2252,6 @@ ksocknal_base_shutdown(void) int i; int j; - CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); LASSERT(ksocknal_data.ksnd_nnets == 0); switch (ksocknal_data.ksnd_init) { @@ -2331,9 +2329,6 @@ ksocknal_base_shutdown(void) break; } - CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - module_put(THIS_MODULE); } diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index fe2a83a540cd..0d5aac6a2bb3 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -526,8 +526,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx) counter++; /* exponential backoff warnings */ if ((counter & (-counter)) == counter) - CWARN("%u ENOMEM tx %p (%u allocated)\n", - counter, conn, atomic_read(&libcfs_kmemory)); + CWARN("%u ENOMEM tx %p\n", counter, conn); /* Queue on ksnd_enomem_conns for retry after a timeout */ spin_lock_bh(&ksocknal_data.ksnd_reaper_lock); diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index ee902dc43823..40f418b82960 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -32,17 +32,6 @@ static struct ctl_table_header *lnet_table_header; -#define CTL_LNET (0x100) -enum { - PSDEV_LNET_STATS = 100, - PSDEV_LNET_ROUTES, - PSDEV_LNET_ROUTERS, - PSDEV_LNET_PEERS, - PSDEV_LNET_BUFFERS, - PSDEV_LNET_NIS, - PSDEV_LNET_PTL_ROTOR, -}; - #define LNET_LOFFT_BITS (sizeof(loff_t) * 8) /* * NB: max allowed LNET_CPT_BITS is 8 on 64-bit system and 2 on 32-bit system diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index f6b369206ace..88e16717e854 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -501,8 +501,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_ONCE CFS_FAIL_ONCE #define OBD_FAILED CFS_FAILED -extern atomic_t libcfs_kmemory; - extern void obd_update_maxusage(void); #define obd_memory_add(size) \ @@ -618,8 +616,8 @@ do { \ if (unlikely((ptr) == NULL)) { \ CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \ (int)(size)); \ - CERROR("%llu total bytes allocated by Lustre, %d by LNET\n", \ - obd_memory_sum(), atomic_read(&libcfs_kmemory)); \ + CERROR("%llu total bytes allocated by Lustre\n", \ + obd_memory_sum()); \ } else { \ OBD_ALLOC_POST(ptr, size, "vmalloced"); \ } \ @@ -765,12 +763,10 @@ do { \ "failed\n", (int)1, \ (__u64)(1 << PAGE_CACHE_SHIFT)); \ CERROR("%llu total bytes and %llu total pages " \ - "(%llu bytes) allocated by Lustre, " \ - "%d total bytes by LNET\n", \ + "(%llu bytes) allocated by Lustre\n", \ obd_memory_sum(), \ obd_pages_sum() << PAGE_CACHE_SHIFT, \ - obd_pages_sum(), \ - atomic_read(&libcfs_kmemory)); \ + obd_pages_sum()); \ } else { \ obd_pages_add(0); \ CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / " \ diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 147004cef391..98075529cc53 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -136,9 +136,6 @@ module_param(libcfs_panic_on_lbug, uint, 0644); MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG"); EXPORT_SYMBOL(libcfs_panic_on_lbug); -atomic_t libcfs_kmemory = ATOMIC_INIT(0); -EXPORT_SYMBOL(libcfs_kmemory); - static wait_queue_head_t debug_ctlwq; char libcfs_debug_file_path_arr[PATH_MAX] = LIBCFS_DEBUG_FILE_PATH_DEFAULT; diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 8b9ce223fc6f..95fa846095ee 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -80,33 +80,6 @@ extern char lnet_upcall[1024]; */ extern char lnet_debug_log_upcall[1024]; -#define CTL_LNET (0x100) - -enum { - PSDEV_DEBUG = 1, /* control debugging */ - PSDEV_SUBSYSTEM_DEBUG, /* control debugging */ - PSDEV_PRINTK, /* force all messages to console */ - PSDEV_CONSOLE_RATELIMIT, /* ratelimit console messages */ - PSDEV_CONSOLE_MAX_DELAY_CS, /* maximum delay over which we skip messages */ - PSDEV_CONSOLE_MIN_DELAY_CS, /* initial delay over which we skip messages */ - PSDEV_CONSOLE_BACKOFF, /* delay increase factor */ - PSDEV_DEBUG_PATH, /* crashdump log location */ - PSDEV_DEBUG_DUMP_PATH, /* crashdump tracelog location */ - PSDEV_CPT_TABLE, /* information about cpu partitions */ - PSDEV_LNET_UPCALL, /* User mode upcall script */ - PSDEV_LNET_MEMUSED, /* bytes currently PORTAL_ALLOCated */ - PSDEV_LNET_CATASTROPHE, /* if we have LBUGged or panic'd */ - PSDEV_LNET_PANIC_ON_LBUG, /* flag to panic on LBUG */ - PSDEV_LNET_DUMP_KERNEL, /* snapshot kernel debug buffer to file */ - PSDEV_LNET_DAEMON_FILE, /* spool kernel debug buffer to file */ - PSDEV_LNET_DEBUG_MB, /* size of debug buffer */ - PSDEV_LNET_DEBUG_LOG_UPCALL, /* debug log upcall script */ - PSDEV_LNET_WATCHDOG_RATELIMIT, /* ratelimit watchdog messages */ - PSDEV_LNET_FORCE_LBUG, /* hook to force an LBUG */ - PSDEV_LNET_FAIL_LOC, /* control test failures instrumentation */ - PSDEV_LNET_FAIL_VAL, /* userdata for fail loc */ -}; - static void kportal_memhog_free (struct libcfs_device_userstate *ldu) { struct page **level0p = &ldu->ldu_memhog_root_page; @@ -450,9 +423,6 @@ static void exit_libcfs_module(void) remove_debugfs(); - CDEBUG(D_MALLOC, "before Portals cleanup: kmem %d\n", - atomic_read(&libcfs_kmemory)); - if (cfs_sched_rehash != NULL) { cfs_wi_sched_destroy(cfs_sched_rehash); cfs_sched_rehash = NULL; @@ -467,10 +437,6 @@ static void exit_libcfs_module(void) cfs_cpu_fini(); - if (atomic_read(&libcfs_kmemory) != 0) - CERROR("Portals memory leaked: %d bytes\n", - atomic_read(&libcfs_kmemory)); - rc = libcfs_debug_cleanup(); if (rc) pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc); @@ -808,13 +774,6 @@ static struct ctl_table lnet_table[] = { .proc_handler = &proc_dostring, }, { - .procname = "lnet_memused", - .data = (int *)&libcfs_kmemory.counter, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, - }, - { .procname = "catastrophe", .data = &libcfs_catastrophe, .maxlen = sizeof(int), diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index edb2c7d525db..2c705d76211f 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -140,11 +140,11 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, CERROR("%s%salloc of %s (%llu bytes) failed at %s:%d\n", ptr ? "force " :"", type, name, (__u64)size, file, line); - CERROR("%llu total bytes and %llu total pages (%llu bytes) allocated by Lustre, %d total bytes by LNET\n", + CERROR("%llu total bytes and %llu total pages" + " (%llu bytes) allocated by Lustre\n", obd_memory_sum(), obd_pages_sum() << PAGE_CACHE_SHIFT, - obd_pages_sum(), - atomic_read(&libcfs_kmemory)); + obd_pages_sum()); return 1; } return 0; |