staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams
authorDmitry Eremin <dmitry.eremin@intel.com>
Mon, 6 Jul 2015 16:48:54 +0000 (12:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jul 2015 02:47:20 +0000 (19:47 -0700)
/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>
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
drivers/staging/lustre/lnet/lnet/router_proc.c
drivers/staging/lustre/lustre/include/obd_support.h
drivers/staging/lustre/lustre/libcfs/debug.c
drivers/staging/lustre/lustre/libcfs/module.c
drivers/staging/lustre/lustre/obdclass/class_obd.c

index ed37d26eb20df8217a4c8d99f45d8f9463f4eba8..9544860e32920a851dd35f20757a199ea5346fef 100644 (file)
@@ -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                                                        \
index 4eb24a11b02a33ece27e487c1b1f81e6ceebfb45..f429d25306c1e125ff826b2b26fb7918e2224265 100644 (file)
@@ -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;
 
index 4128a92218a99c3a789a3236aadf1ec9e1c768f1..d8bfcadd184a8bb94001b65619e63b6104e71e64 100644 (file)
@@ -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);
 }
 
index fe2a83a540cdb040adbb795ecfa0e5d3a53489c8..0d5aac6a2bb3c4c6e941588e378a794ff5559859 100644 (file)
@@ -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);
index ee902dc43823ff201cf1a3d41530b47008a29184..40f418b82960746b5cde2324a7a40d57ae43c775 100644 (file)
 
 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
index f6b369206ace63b204b2f5768fa425acec4dc42c..88e16717e854e3f77e03943146a6823a6fb01e7b 100644 (file)
@@ -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) / "      \
index 147004cef3914fa0a21bb3437a235bb62941afc7..98075529cc531b6d250df7f71228730e23867519 100644 (file)
@@ -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;
index 8b9ce223fc6fd6cb1c8f8eae0a9d8671ede20475..95fa846095ee68e8b789a2b749a8058fd861bb90 100644 (file)
@@ -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);
@@ -807,13 +773,6 @@ static struct ctl_table lnet_table[] = {
                .mode     = 0644,
                .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,
index edb2c7d525db8af92d3fc3da6b4656032ed6c39e..2c705d76211f88b84a52e71bc790009c5139f84e 100644 (file)
@@ -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;