[Devel] [PATCH rh7 3/5] ub: drop ub_debug* macros

Vladimir Davydov vdavydov at parallels.com
Tue Jun 9 08:14:59 PDT 2015


They were used for tracing ub routines. In fact, they were never used,
because they had to be enabled at compile time. No need in them as we
have ftrace. At worst, one can always insert his own tracing routines
wherever he wants.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 include/bc/beancounter.h |  1 -
 include/bc/debug.h       | 64 ------------------------------------------------
 kernel/bc/beancounter.c  |  8 ------
 kernel/bc/sys.c          | 11 +--------
 4 files changed, 1 insertion(+), 83 deletions(-)
 delete mode 100644 include/bc/debug.h

diff --git a/include/bc/beancounter.h b/include/bc/beancounter.h
index 779a213576a3..9180f2a04f56 100644
--- a/include/bc/beancounter.h
+++ b/include/bc/beancounter.h
@@ -21,7 +21,6 @@
 #include <linux/percpu_counter.h>
 #include <linux/ratelimit.h>
 #include <linux/cgroup.h>
-#include <bc/debug.h>
 #include <bc/decl.h>
 #include <asm/atomic.h>
 
diff --git a/include/bc/debug.h b/include/bc/debug.h
deleted file mode 100644
index 2f18c96453f9..000000000000
--- a/include/bc/debug.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  include/bc/debug.h
- *
- *  Copyright (C) 2005  SWsoft
- *  All rights reserved.
- *  
- *  Licensing governed by "linux/COPYING.SWsoft" file.
- *
- */
-
-#ifndef __BC_DEBUG_H_
-#define __BC_DEBUG_H_
-
-/*
- * general debugging
- */
-
-#define UBD_ALLOC	0x1
-#define UBD_CHARGE	0x2
-#define UBD_LIMIT	0x4
-#define UBD_TRACE	0x8
-
-/*
- * ub_net debugging
- */
-
-#define UBD_NET_SOCKET	0x10
-#define UBD_NET_SLEEP	0x20
-#define UBD_NET_SEND	0x40
-#define UBD_NET_RECV	0x80
-
-/*
- * Main routines
- */
-
-#define UB_DEBUG (0)
-#define DEBUG_RESOURCE (0ULL)
-
-#define ub_dbg_cond(__cond, __str, args...)				\
-	do { 								\
-		if ((__cond) != 0)					\
-			printk(__str, ##args);				\
-	} while(0)
-
-#define ub_debug(__section, __str, args...) 				\
-	ub_dbg_cond(UB_DEBUG & (__section), __str, ##args)
-
-#define ub_debug_resource(__resource, __str, args...)			\
-	ub_dbg_cond((UB_DEBUG & UBD_CHARGE) && 				\
-			(DEBUG_RESOURCE & (1 << (__resource))), 	\
-			__str, ##args)
-
-#if UB_DEBUG & UBD_TRACE
-#define ub_debug_trace(__cond, __b, __r)				\
-		do {							\
-			static DEFINE_RATELIMIT_STATE(rl, __r, __b);	\
-			if ((__cond) != 0 && __ratelimit(&rl))		\
-				dump_stack(); 				\
-		} while(0)
-#else
-#define ub_debug_trace(__cond, __burst, __rate)
-#endif
-
-#endif
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index a439404c49d0..2f1ad7b8e310 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -335,7 +335,6 @@ int ub_count;
 static struct user_beancounter *alloc_ub(const char *name)
 {
 	struct user_beancounter *new_ub;
-	ub_debug(UBD_ALLOC, "Creating ub %p\n", new_ub);
 
 	new_ub = kmem_cache_zalloc(ub_cachep, GFP_KERNEL);
 	if (new_ub == NULL)
@@ -497,8 +496,6 @@ static inline int bc_verify_held(struct user_beancounter *ub)
 			__ub_stat_get(ub, writeback_pages));
 	clean &= verify_res(ub, "tmpfs_respages", ub->ub_tmpfs_respages);
 
-	ub_debug_trace(!clean, 5, 60*HZ);
-
 	return clean;
 }
 
@@ -832,8 +829,6 @@ EXPORT_SYMBOL(ub_subsys);
 int __charge_beancounter_locked(struct user_beancounter *ub,
 		int resource, unsigned long val, enum ub_severity strict)
 {
-	ub_debug_resource(resource, "Charging %lu for %d of %p with %lu\n",
-			val, resource, ub, ub->ub_parms[resource].held);
 	/*
 	 * ub_value <= UB_MAXVALUE, value <= UB_MAXVALUE, and only one addition
 	 * at the moment is possible so an overflow is impossible.  
@@ -892,14 +887,11 @@ void uncharge_warn(struct user_beancounter *ub, const char *resource,
 {
 	printk(KERN_ERR "Uncharging too much %lu h %lu, res %s ub %s\n",
 			val, held, resource, ub->ub_name);
-	ub_debug_trace(1, 10, 10*HZ);
 }
 
 void __uncharge_beancounter_locked(struct user_beancounter *ub,
 		int resource, unsigned long val)
 {
-	ub_debug_resource(resource, "Uncharging %lu for %d of %p with %lu\n",
-			val, resource, ub, ub->ub_parms[resource].held);
 	if (ub->ub_parms[resource].held < val) {
 		uncharge_warn(ub, ub_rnames[resource],
 				val, ub->ub_parms[resource].held);
diff --git a/kernel/bc/sys.c b/kernel/bc/sys.c
index 3c0b9abf0df4..33dac2971ae8 100644
--- a/kernel/bc/sys.c
+++ b/kernel/bc/sys.c
@@ -58,14 +58,7 @@ SYSCALL_DEFINE1(setluid, uid_t, uid)
 	ub = get_beancounter_byuid(uid, 1);
 	if (ub == NULL)
 		goto out;
-
-	ub_debug(UBD_ALLOC | UBD_LIMIT, "setluid, bean %p (count %d) "
-			"for %.20s pid %d\n",
-			ub, css_refcnt(&ub->css),
-			current->comm, current->pid);
-
 	error = ub_attach_task(ub, current);
-
 	put_beancounter(ub);
 out:
 	return error;
@@ -88,10 +81,8 @@ long do_setublimit(uid_t uid, unsigned long resource,
 
 	error = -ENOENT;
 	ub = get_beancounter_byuid(uid, 0);
-	if (ub == NULL) {
-		ub_debug(UBD_LIMIT, "No login bc for uid %d\n", uid);
+	if (ub == NULL)
 		goto out;
-	}
 
 	ub_sync_memcg(ub);
 
-- 
2.1.4




More information about the Devel mailing list