linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: green@linuxhacker.ru
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Oleg Drokin <green@linuxhacker.ru>,
	Oleg Drokin <oleg.drokin@intel.com>
Subject: [PATCH 15/19] staging/lustre: Remove lustre used memory tracking framework
Date: Tue, 15 Sep 2015 20:30:39 -0400	[thread overview]
Message-ID: <1442363443-3485158-16-git-send-email-green@linuxhacker.ru> (raw)
In-Reply-To: <1442363443-3485158-1-git-send-email-green@linuxhacker.ru>

From: Oleg Drokin <green@linuxhacker.ru>

Lustre memory allocation framework has a feature to track amount
of allocated memory, but since it's not being used consistently anymore
and is on the way out in general, just remove it.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../staging/lustre/lustre/include/obd_support.h    | 60 +-------------------
 drivers/staging/lustre/lustre/obdclass/class_obd.c | 64 ----------------------
 drivers/staging/lustre/lustre/ptlrpc/pinger.c      |  2 -
 3 files changed, 1 insertion(+), 125 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 3d92f19..62d76b5 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -494,50 +494,6 @@ extern char obd_jobid_var[];
 #define OBD_FAIL_ONCE			   CFS_FAIL_ONCE
 #define OBD_FAILED			      CFS_FAILED
 
-void obd_update_maxusage(void);
-
-#define obd_memory_add(size)						  \
-	lprocfs_counter_add(obd_memory, OBD_MEMORY_STAT, (long)(size))
-#define obd_memory_sub(size)						  \
-	lprocfs_counter_sub(obd_memory, OBD_MEMORY_STAT, (long)(size))
-#define obd_memory_sum()						      \
-	lprocfs_stats_collector(obd_memory, OBD_MEMORY_STAT,		  \
-				LPROCFS_FIELDS_FLAGS_SUM)
-#define obd_pages_add(order)						  \
-	lprocfs_counter_add(obd_memory, OBD_MEMORY_PAGES_STAT,		\
-			    (long)(1 << (order)))
-#define obd_pages_sub(order)						  \
-	lprocfs_counter_sub(obd_memory, OBD_MEMORY_PAGES_STAT,		\
-			    (long)(1 << (order)))
-#define obd_pages_sum()						       \
-	lprocfs_stats_collector(obd_memory, OBD_MEMORY_PAGES_STAT,	    \
-				LPROCFS_FIELDS_FLAGS_SUM)
-
-__u64 obd_memory_max(void);
-__u64 obd_pages_max(void);
-
-#define OBD_DEBUG_MEMUSAGE (1)
-
-#if OBD_DEBUG_MEMUSAGE
-#define OBD_ALLOC_POST(ptr, size, name)				 \
-		obd_memory_add(size);				   \
-		CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n",       \
-		       (int)(size), ptr)
-
-#define OBD_FREE_PRE(ptr, size, name)				   \
-	LASSERT(ptr);						   \
-	obd_memory_sub(size);					   \
-	CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n",	       \
-	       (int)(size), ptr);				       \
-	POISON(ptr, 0x5a, size)
-
-#else /* !OBD_DEBUG_MEMUSAGE */
-
-#define OBD_ALLOC_POST(ptr, size, name) ((void)0)
-#define OBD_FREE_PRE(ptr, size, name)   ((void)0)
-
-#endif /* !OBD_DEBUG_MEMUSAGE */
-
 #ifdef CONFIG_DEBUG_SLAB
 #define POISON(ptr, c, s) do {} while (0)
 #define POISON_PTR(ptr)  ((void)0)
@@ -583,8 +539,6 @@ do {									      \
 		kmem_cache_alloc(slab, type | __GFP_ZERO) :		\
 		kmem_cache_alloc_node(slab, type | __GFP_ZERO,		\
 				      cfs_cpt_spread_node(cptab, cpt));	\
-	if (likely(ptr))						\
-		OBD_ALLOC_POST(ptr, size, "slab-alloced");		    \
 } while (0)
 
 #define OBD_SLAB_ALLOC_GFP(ptr, slab, size, flags)			      \
@@ -594,7 +548,6 @@ do {									      \
 
 #define OBD_SLAB_FREE(ptr, slab, size)					\
 do {									  \
-	OBD_FREE_PRE(ptr, size, "slab-freed");				\
 	kmem_cache_free(slab, ptr);					\
 	POISON_PTR(ptr);						      \
 } while (0)
@@ -629,17 +582,7 @@ do {									      \
 	(ptr) = (cptab) == NULL ?					      \
 		alloc_page(gfp_mask) :				      \
 		alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), gfp_mask, 0);\
-	if (unlikely((ptr) == NULL)) {					\
-		CERROR("alloc_pages of '" #ptr "' %d page(s) / %llu bytes "\
-		       "failed\n", (int)1,				    \
-		       (__u64)(1 << PAGE_CACHE_SHIFT));			 \
-		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());				       \
-	} else {							      \
-		obd_pages_add(0);					     \
+	if (ptr) {					\
 		CDEBUG(D_MALLOC, "alloc_pages '" #ptr "': %d page(s) / "      \
 		       "%llu bytes at %p.\n",				\
 		       (int)1,						\
@@ -655,7 +598,6 @@ do {									      \
 #define OBD_PAGE_FREE(ptr)						    \
 do {									  \
 	LASSERT(ptr);							 \
-	obd_pages_sub(0);						     \
 	CDEBUG(D_MALLOC, "free_pages '" #ptr "': %d page(s) / %llu bytes " \
 	       "at %p.\n",						    \
 	       (int)1, (__u64)(1 << PAGE_CACHE_SHIFT),			  \
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index fb4138c..32daefb 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -53,16 +53,6 @@ EXPORT_SYMBOL(obd_devs);
 struct list_head obd_types;
 DEFINE_RWLOCK(obd_dev_lock);
 
-__u64 obd_max_pages;
-EXPORT_SYMBOL(obd_max_pages);
-__u64 obd_max_alloc;
-EXPORT_SYMBOL(obd_max_alloc);
-__u64 obd_alloc;
-EXPORT_SYMBOL(obd_alloc);
-__u64 obd_pages;
-EXPORT_SYMBOL(obd_pages);
-static DEFINE_SPINLOCK(obd_updatemax_lock);
-
 /* The following are visible and mutable through /proc/sys/lustre/. */
 unsigned int obd_debug_peer_on_timeout;
 EXPORT_SYMBOL(obd_debug_peer_on_timeout);
@@ -572,54 +562,12 @@ static int __init init_obdclass(void)
 	return err;
 }
 
-void obd_update_maxusage(void)
-{
-	__u64 max1, max2;
-
-	max1 = obd_pages_sum();
-	max2 = obd_memory_sum();
-
-	spin_lock(&obd_updatemax_lock);
-	if (max1 > obd_max_pages)
-		obd_max_pages = max1;
-	if (max2 > obd_max_alloc)
-		obd_max_alloc = max2;
-	spin_unlock(&obd_updatemax_lock);
-}
-EXPORT_SYMBOL(obd_update_maxusage);
-
-__u64 obd_memory_max(void)
-{
-	__u64 ret;
-
-	spin_lock(&obd_updatemax_lock);
-	ret = obd_max_alloc;
-	spin_unlock(&obd_updatemax_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL(obd_memory_max);
-
-__u64 obd_pages_max(void)
-{
-	__u64 ret;
-
-	spin_lock(&obd_updatemax_lock);
-	ret = obd_max_pages;
-	spin_unlock(&obd_updatemax_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL(obd_pages_max);
-
 /* liblustre doesn't call cleanup_obdclass, apparently.  we carry on in this
  * ifdef to the end of the file to cover module and versioning goo.*/
 static void cleanup_obdclass(void)
 {
 	int i;
 	int lustre_unregister_fs(void);
-	__u64 memory_leaked, pages_leaked;
-	__u64 memory_max, pages_max;
 
 	lustre_unregister_fs();
 
@@ -645,19 +593,7 @@ static void cleanup_obdclass(void)
 	class_exit_uuidlist();
 	obd_zombie_impexp_stop();
 
-	memory_leaked = obd_memory_sum();
-	pages_leaked = obd_pages_sum();
-
-	memory_max = obd_memory_max();
-	pages_max = obd_pages_max();
-
 	lprocfs_free_stats(&obd_memory);
-	CDEBUG((memory_leaked) ? D_ERROR : D_INFO,
-	       "obd_memory max: %llu, leaked: %llu\n",
-	       memory_max, memory_leaked);
-	CDEBUG((pages_leaked) ? D_ERROR : D_INFO,
-	       "obd_memory_pages max: %llu, leaked: %llu\n",
-	       pages_max, pages_leaked);
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
index d3aea4a..6cd4cfa 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
@@ -266,8 +266,6 @@ static int ptlrpc_pinger_main(void *arg)
 				ptlrpc_update_next_ping(imp, 0);
 		}
 		mutex_unlock(&pinger_mutex);
-		/* update memory usage info */
-		obd_update_maxusage();
 
 		/* Wait until the next ping time, or until we're stopped. */
 		time_to_next_wake = pinger_check_timeout(this_ping);
-- 
2.1.0


  parent reply	other threads:[~2015-09-16  0:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16  0:30 [PATCH 00/19] Lustre cleanups green
2015-09-16  0:30 ` [PATCH 01/19] staging/lustre: Remove OBD_CPT_ALLOC_LARGE green
2015-09-16  0:30 ` [PATCH 02/19] staging/lustre: Remove unused OBD_VMALLOC green
2015-09-16  0:30 ` [PATCH 03/19] staging/lustre: Remove unused OBD_CPT_ALLOC* macros green
2015-09-16  0:30 ` [PATCH 04/19] staging/lustre: Remove users of OBD_ALLOC/FREE_PTR lu_object.h green
2015-09-16  0:30 ` [PATCH 05/19] staging/lustre/llite: Get rid of OBD_ALLOC/FREE_PTR green
2015-09-16  0:30 ` [PATCH 06/19] staging/lustre/obdclass: replace OBD_ALLOC_GFP with kzalloc green
2015-09-16  0:30 ` [PATCH 07/19] staging/lustre: Remove references to OBD_ALLOC/FREE* in comments green
2015-09-16  0:30 ` [PATCH 08/19] staging/lustre/fld: Replace OBD_ALLOC_GFP with kzalloc green
2015-09-16  0:30 ` [PATCH 09/19] staging/lustre: Convert lustre_cfg_new/free to use kzalloc/kfree green
2015-09-16  0:30 ` [PATCH 10/19] staging/lustre/ptlrpc: Replace OBD_FREE_PTR with kfree green
2015-09-16  0:30 ` [PATCH 11/19] staging/lustre: Replace last users of OBD_ALLOC/FREE_LARGE green
2015-09-16  0:30 ` [PATCH 12/19] staging/lustre: Remove stray bit of userland utils code green
2015-09-16  0:30 ` [PATCH 13/19] staging/lustre: Remove unused OBD_ALLOC* and OBD_FREE macros green
2015-09-16  0:30 ` [PATCH 14/19] staging/lustre: Remove memory allocation fault injection framework green
2015-09-16  0:30 ` green [this message]
2015-09-16  0:30 ` [PATCH 16/19] staging/lustre: remove obd_memory stats counter green
2015-09-16  0:30 ` [PATCH 17/19] staging/lustre: Remove IS_SERVER and all users green
2015-09-16  5:35   ` Sudip Mukherjee
2015-09-16 15:08     ` Oleg Drokin
2015-09-16  0:30 ` [PATCH 18/19] staging/lustre: remove IS_MDS|IS_OST|IS_MGS defines and users green
2015-09-16  0:30 ` [PATCH 19/19] staging/lustre: Remove server defines from lustre_disk.h green

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442363443-3485158-16-git-send-email-green@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).