[Devel] [PATCH rh7] ub: zap ub_reclaim_rate_limit

Vladimir Davydov vdavydov at parallels.com
Thu May 21 06:10:42 PDT 2015


This was used for throttling virtual swap in/out. We do not need it
anymore as we do not need virtual swap, because its functionality is now
implemented as a part of frontswap/tswap. If we want virtual swap in/out
throttling, we should add it to tswap.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 include/bc/beancounter.h |   10 ----------
 kernel/bc/beancounter.c  |   29 -----------------------------
 2 files changed, 39 deletions(-)

diff --git a/include/bc/beancounter.h b/include/bc/beancounter.h
index 8e384f8ada6d..ea05b112570b 100644
--- a/include/bc/beancounter.h
+++ b/include/bc/beancounter.h
@@ -137,11 +137,6 @@ struct user_beancounter {
 	atomic_long_t		wb_requests;
 	atomic_long_t		wb_sectors;
 
-	/* reclaim rate-limit */
-	spinlock_t		rl_lock;
-	unsigned		rl_step;	/* ns per page */
-	ktime_t			rl_wall;	/* wall time */
-
 	void			*private_data2;
 
 	/* resources statistic and settings */
@@ -261,9 +256,6 @@ static inline void uncharge_beancounter(struct user_beancounter *ub,
 			int resource, unsigned long val) { }
 #define uncharge_beancounter_fast uncharge_beancounter
 
-static inline void ub_reclaim_rate_limit(struct user_beancounter *ub,
-					 int wait, unsigned count) { }
-
 #else /* CONFIG_BEANCOUNTERS */
 
 extern struct list_head ub_list_head;
@@ -510,8 +502,6 @@ int precharge_beancounter(struct user_beancounter *ub,
 		int resource, unsigned long val);
 void ub_precharge_snapshot(struct user_beancounter *ub, int *precharge);
 
-void ub_reclaim_rate_limit(struct user_beancounter *ub, int wait, unsigned count);
-
 #define UB_IOPRIO_MIN 0
 #define UB_IOPRIO_MAX 8
 
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 498d1d33db58..48f5a25d2add 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -856,28 +856,6 @@ out:
 }
 EXPORT_SYMBOL(precharge_beancounter);
 
-void ub_reclaim_rate_limit(struct user_beancounter *ub, int wait, unsigned count)
-{
-	ktime_t wall;
-	u64 step;
-
-	if (!ub->rl_step)
-		return;
-
-	spin_lock(&ub->rl_lock);
-	step = (u64)ub->rl_step * count;
-	wall = ktime_add_ns(ktime_get(), step);
-	if (wall.tv64 < ub->rl_wall.tv64)
-		wall = ktime_add_ns(ub->rl_wall, step);
-	ub->rl_wall = wall;
-	spin_unlock(&ub->rl_lock);
-
-	if (wait && get_exec_ub() == ub && !test_thread_flag(TIF_MEMDIE)) {
-		set_current_state(TASK_KILLABLE);
-		schedule_hrtimeout(&wall, HRTIMER_MODE_ABS);
-	}
-}
-
 /*
  *	Initialization
  *
@@ -897,8 +875,6 @@ static void init_beancounter_struct(struct user_beancounter *ub)
 	spin_lock_init(&ub->ub_lock);
 	INIT_LIST_HEAD(&ub->ub_tcp_sk_list);
 	INIT_LIST_HEAD(&ub->ub_other_sk_list);
-	spin_lock_init(&ub->rl_lock);
-	ub->rl_wall.tv64 = LLONG_MIN;
 }
 
 static void init_beancounter_nolimits(struct user_beancounter *ub)
@@ -917,9 +893,6 @@ static void init_beancounter_nolimits(struct user_beancounter *ub)
 	/* FIXME: set unlimited rate? */
 	ub->ub_ratelimit.burst = 4;
 	ub->ub_ratelimit.interval = 300*HZ;
-
-	if (ub != get_ub0())
-		ub->rl_step = NSEC_PER_SEC / 25600; /* 100 Mb/s */
 }
 
 static void init_beancounter_syslimits(struct user_beancounter *ub)
@@ -953,8 +926,6 @@ static void init_beancounter_syslimits(struct user_beancounter *ub)
 
 	ub->ub_ratelimit.burst = 4;
 	ub->ub_ratelimit.interval = 300*HZ;
-
-	ub->rl_step = NSEC_PER_SEC / 25600; /* 100 Mb/s */
 }
 
 static DEFINE_PER_CPU(struct ub_percpu_struct, ub0_percpu);
-- 
1.7.10.4




More information about the Devel mailing list