Commit 323b0b2c authored by Dmitry Eremin's avatar Dmitry Eremin Committed by Greg Kroah-Hartman

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: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8710427d
...@@ -87,24 +87,6 @@ do { \ ...@@ -87,24 +87,6 @@ do { \
lbug_with_loc(&msgdata); \ lbug_with_loc(&msgdata); \
} while (0) } 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 #ifndef LIBCFS_VMALLOC_SIZE
#define LIBCFS_VMALLOC_SIZE (2 << PAGE_CACHE_SHIFT) /* 2 pages */ #define LIBCFS_VMALLOC_SIZE (2 << PAGE_CACHE_SHIFT) /* 2 pages */
#endif #endif
...@@ -121,14 +103,9 @@ do { \ ...@@ -121,14 +103,9 @@ do { \
if (unlikely((ptr) == NULL)) { \ if (unlikely((ptr) == NULL)) { \
CERROR("LNET: out of memory at %s:%d (tried to alloc '" \ CERROR("LNET: out of memory at %s:%d (tried to alloc '" \
#ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \ #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size)); \
CERROR("LNET: %d total bytes allocated by lnet\n", \
libcfs_kmem_read()); \
} else { \ } else { \
memset((ptr), 0, (size)); \ 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) } while (0)
/** /**
...@@ -180,9 +157,6 @@ do { \ ...@@ -180,9 +157,6 @@ do { \
"%s:%d\n", s, __FILE__, __LINE__); \ "%s:%d\n", s, __FILE__, __LINE__); \
break; \ 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)) \ if (unlikely(s > LIBCFS_VMALLOC_SIZE)) \
vfree(ptr); \ vfree(ptr); \
else \ else \
......
...@@ -2667,9 +2667,6 @@ static void kiblnd_base_shutdown(void) ...@@ -2667,9 +2667,6 @@ static void kiblnd_base_shutdown(void)
LASSERT(list_empty(&kiblnd_data.kib_devs)); 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) { switch (kiblnd_data.kib_init) {
default: default:
LBUG(); LBUG();
...@@ -2720,9 +2717,6 @@ static void kiblnd_base_shutdown(void) ...@@ -2720,9 +2717,6 @@ static void kiblnd_base_shutdown(void)
if (kiblnd_data.kib_scheds != NULL) if (kiblnd_data.kib_scheds != NULL)
cfs_percpt_free(kiblnd_data.kib_scheds); 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; kiblnd_data.kib_init = IBLND_INIT_NOTHING;
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
...@@ -2739,9 +2733,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) ...@@ -2739,9 +2733,6 @@ void kiblnd_shutdown(lnet_ni_t *ni)
if (net == NULL) if (net == NULL)
goto out; goto out;
CDEBUG(D_MALLOC, "before LND net cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
write_lock_irqsave(g_lock, flags); write_lock_irqsave(g_lock, flags);
net->ibn_shutdown = 1; net->ibn_shutdown = 1;
write_unlock_irqrestore(g_lock, flags); write_unlock_irqrestore(g_lock, flags);
...@@ -2786,9 +2777,6 @@ void kiblnd_shutdown(lnet_ni_t *ni) ...@@ -2786,9 +2777,6 @@ void kiblnd_shutdown(lnet_ni_t *ni)
break; break;
} }
CDEBUG(D_MALLOC, "after LND net cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
net->ibn_init = IBLND_INIT_NOTHING; net->ibn_init = IBLND_INIT_NOTHING;
ni->ni_data = NULL; ni->ni_data = NULL;
......
...@@ -2252,8 +2252,6 @@ ksocknal_base_shutdown(void) ...@@ -2252,8 +2252,6 @@ ksocknal_base_shutdown(void)
int i; int i;
int j; int j;
CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
LASSERT(ksocknal_data.ksnd_nnets == 0); LASSERT(ksocknal_data.ksnd_nnets == 0);
switch (ksocknal_data.ksnd_init) { switch (ksocknal_data.ksnd_init) {
...@@ -2331,9 +2329,6 @@ ksocknal_base_shutdown(void) ...@@ -2331,9 +2329,6 @@ ksocknal_base_shutdown(void)
break; break;
} }
CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
......
...@@ -526,8 +526,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx) ...@@ -526,8 +526,7 @@ ksocknal_process_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
counter++; /* exponential backoff warnings */ counter++; /* exponential backoff warnings */
if ((counter & (-counter)) == counter) if ((counter & (-counter)) == counter)
CWARN("%u ENOMEM tx %p (%u allocated)\n", CWARN("%u ENOMEM tx %p\n", counter, conn);
counter, conn, atomic_read(&libcfs_kmemory));
/* Queue on ksnd_enomem_conns for retry after a timeout */ /* Queue on ksnd_enomem_conns for retry after a timeout */
spin_lock_bh(&ksocknal_data.ksnd_reaper_lock); spin_lock_bh(&ksocknal_data.ksnd_reaper_lock);
......
...@@ -32,17 +32,6 @@ ...@@ -32,17 +32,6 @@
static struct ctl_table_header *lnet_table_header; 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) #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 * NB: max allowed LNET_CPT_BITS is 8 on 64-bit system and 2 on 32-bit system
......
...@@ -501,8 +501,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, ...@@ -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_FAIL_ONCE CFS_FAIL_ONCE
#define OBD_FAILED CFS_FAILED #define OBD_FAILED CFS_FAILED
extern atomic_t libcfs_kmemory;
extern void obd_update_maxusage(void); extern void obd_update_maxusage(void);
#define obd_memory_add(size) \ #define obd_memory_add(size) \
...@@ -618,8 +616,8 @@ do { \ ...@@ -618,8 +616,8 @@ do { \
if (unlikely((ptr) == NULL)) { \ if (unlikely((ptr) == NULL)) { \
CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \ CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \
(int)(size)); \ (int)(size)); \
CERROR("%llu total bytes allocated by Lustre, %d by LNET\n", \ CERROR("%llu total bytes allocated by Lustre\n", \
obd_memory_sum(), atomic_read(&libcfs_kmemory)); \ obd_memory_sum()); \
} else { \ } else { \
OBD_ALLOC_POST(ptr, size, "vmalloced"); \ OBD_ALLOC_POST(ptr, size, "vmalloced"); \
} \ } \
...@@ -765,12 +763,10 @@ do { \ ...@@ -765,12 +763,10 @@ do { \
"failed\n", (int)1, \ "failed\n", (int)1, \
(__u64)(1 << PAGE_CACHE_SHIFT)); \ (__u64)(1 << PAGE_CACHE_SHIFT)); \
CERROR("%llu total bytes and %llu total pages " \ CERROR("%llu total bytes and %llu total pages " \
"(%llu bytes) allocated by Lustre, " \ "(%llu bytes) allocated by Lustre\n", \
"%d total bytes by LNET\n", \
obd_memory_sum(), \ obd_memory_sum(), \
obd_pages_sum() << PAGE_CACHE_SHIFT, \ obd_pages_sum() << PAGE_CACHE_SHIFT, \
obd_pages_sum(), \ obd_pages_sum()); \
atomic_read(&libcfs_kmemory)); \
} else { \ } else { \
obd_pages_add(0); \ obd_pages_add(0); \
CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / " \ CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / " \
......
...@@ -136,9 +136,6 @@ module_param(libcfs_panic_on_lbug, uint, 0644); ...@@ -136,9 +136,6 @@ module_param(libcfs_panic_on_lbug, uint, 0644);
MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG"); MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG");
EXPORT_SYMBOL(libcfs_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; static wait_queue_head_t debug_ctlwq;
char libcfs_debug_file_path_arr[PATH_MAX] = LIBCFS_DEBUG_FILE_PATH_DEFAULT; char libcfs_debug_file_path_arr[PATH_MAX] = LIBCFS_DEBUG_FILE_PATH_DEFAULT;
......
...@@ -80,33 +80,6 @@ extern char lnet_upcall[1024]; ...@@ -80,33 +80,6 @@ extern char lnet_upcall[1024];
*/ */
extern char lnet_debug_log_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) static void kportal_memhog_free (struct libcfs_device_userstate *ldu)
{ {
struct page **level0p = &ldu->ldu_memhog_root_page; struct page **level0p = &ldu->ldu_memhog_root_page;
...@@ -450,9 +423,6 @@ static void exit_libcfs_module(void) ...@@ -450,9 +423,6 @@ static void exit_libcfs_module(void)
remove_debugfs(); remove_debugfs();
CDEBUG(D_MALLOC, "before Portals cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory));
if (cfs_sched_rehash != NULL) { if (cfs_sched_rehash != NULL) {
cfs_wi_sched_destroy(cfs_sched_rehash); cfs_wi_sched_destroy(cfs_sched_rehash);
cfs_sched_rehash = NULL; cfs_sched_rehash = NULL;
...@@ -467,10 +437,6 @@ static void exit_libcfs_module(void) ...@@ -467,10 +437,6 @@ static void exit_libcfs_module(void)
cfs_cpu_fini(); cfs_cpu_fini();
if (atomic_read(&libcfs_kmemory) != 0)
CERROR("Portals memory leaked: %d bytes\n",
atomic_read(&libcfs_kmemory));
rc = libcfs_debug_cleanup(); rc = libcfs_debug_cleanup();
if (rc) if (rc)
pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc); pr_err("LustreError: libcfs_debug_cleanup: %d\n", rc);
...@@ -807,13 +773,6 @@ static struct ctl_table lnet_table[] = { ...@@ -807,13 +773,6 @@ static struct ctl_table lnet_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dostring, .proc_handler = &proc_dostring,
}, },
{
.procname = "lnet_memused",
.data = (int *)&libcfs_kmemory.counter,
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = &proc_dointvec,
},
{ {
.procname = "catastrophe", .procname = "catastrophe",
.data = &libcfs_catastrophe, .data = &libcfs_catastrophe,
......
...@@ -140,11 +140,11 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, ...@@ -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", CERROR("%s%salloc of %s (%llu bytes) failed at %s:%d\n",
ptr ? "force " :"", type, name, (__u64)size, file, ptr ? "force " :"", type, name, (__u64)size, file,
line); 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_memory_sum(),
obd_pages_sum() << PAGE_CACHE_SHIFT, obd_pages_sum() << PAGE_CACHE_SHIFT,
obd_pages_sum(), obd_pages_sum());
atomic_read(&libcfs_kmemory));
return 1; return 1;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment