[Devel] [PATCH RHEL7 COMMIT] ub: drop ub_debug* macros

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 10 07:16:33 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.12
------>
commit a327fdcdfa2a978f027fe39ad54b4b9ffd26170f
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Wed Jun 10 18:16:33 2015 +0400

    ub: drop ub_debug* macros
    
    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(-)

diff --git a/include/bc/beancounter.h b/include/bc/beancounter.h
index 340d097..cb908e8 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 2f18c96..0000000
--- 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 81f5518..adb30ed 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -348,7 +348,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)
@@ -510,8 +509,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;
 }
 
@@ -845,8 +842,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.  
@@ -905,14 +900,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 3c0b9ab..33dac29 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);
 



More information about the Devel mailing list