[Devel] [PATCH rh7 01/11] ub: remove some dead code

Vladimir Davydov vdavydov at parallels.com
Wed May 20 02:00:38 PDT 2015


This patch removes remnants from physpages, swappages, kmemsize,
dcachesize, and oomguarpages handling logic. These resource types are
either already handled by memcg, or will be soon, or will be reworked.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 include/bc/vmpages.h    |    6 ------
 kernel/bc/beancounter.c |   19 +------------------
 mm/memory.c             |    3 +--
 3 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/include/bc/vmpages.h b/include/bc/vmpages.h
index 65d9de4f0145..4833ef8a08bf 100644
--- a/include/bc/vmpages.h
+++ b/include/bc/vmpages.h
@@ -47,12 +47,6 @@ UB_DECLARE_FUNC(int, ub_lockedshm_charge(struct shmem_inode_info *shi,
 UB_DECLARE_VOID_FUNC(ub_lockedshm_uncharge(struct shmem_inode_info *shi,
 			unsigned long size))
 
-static inline int ub_swap_full(struct user_beancounter *ub)
-{
-	return (ub->ub_parms[UB_SWAPPAGES].held * 2 >
-			ub->ub_parms[UB_SWAPPAGES].limit);
-}
-
 void __show_ub_mem(struct user_beancounter *ub);
 void show_ub_mem(struct user_beancounter *ub);
 
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 8cbf7d4b7192..3b5a20f5a4c8 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -84,14 +84,10 @@ static int ubc_ioprio = 1;
 
 /* default maximum perpcu resources precharge */
 int ub_resource_precharge[UB_RESOURCES] = {
-	[UB_KMEMSIZE]	= 32 * PAGE_SIZE,
-       [UB_PRIVVMPAGES]= 256,
+	[UB_PRIVVMPAGES]= 256,
 	[UB_NUMPROC]	= 4,
-	[UB_PHYSPAGES]	= 512,	/* up to 2Mb, 1 huge page */
 	[UB_NUMSIGINFO]	= 4,
-	[UB_DCACHESIZE] = 4 * PAGE_SIZE,
 	[UB_NUMFILE]	= 8,
-	[UB_SWAPPAGES]	= 256,
 };
 
 /* natural limits for percpu precharge bounds */
@@ -296,8 +292,6 @@ void ub_precharge_snapshot(struct user_beancounter *ub, int *precharge)
 		for ( resource = 0 ; resource < UB_RESOURCES ; resource++ )
 			precharge[resource] += pcpu->precharge[resource];
 	}
-	precharge[UB_PHYSPAGES] += precharge[UB_KMEMSIZE] >> PAGE_SHIFT;
-	precharge[UB_OOMGUARPAGES] = precharge[UB_SWAPPAGES];
 }
 
 static void uncharge_beancounter_precharge(struct user_beancounter *ub)
@@ -880,17 +874,6 @@ unsigned long __get_beancounter_usage_percpu(struct user_beancounter *ub,
 	smp_rmb();
 	precharge = __ub_percpu_sum(ub, precharge[resource]);
 
-	switch (resource) {
-	case UB_PHYSPAGES:
-		/* kmemsize precharge already charged into physpages  */
-		precharge += __ub_percpu_sum(ub, precharge[UB_KMEMSIZE]) >> PAGE_SHIFT;
-		break;
-	case UB_OOMGUARPAGES:
-		/* oomguarpages contains swappages and its precharge too */
-		precharge = __ub_percpu_sum(ub, precharge[UB_SWAPPAGES]);
-		break;
-	}
-
 	return max(0l, held - precharge);
 }
 
diff --git a/mm/memory.c b/mm/memory.c
index 5ec71da74245..5acbed3b7e34 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3193,8 +3193,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
 	mem_cgroup_commit_charge_swapin(page, ptr);
 
 	swap_free(entry);
-	if (vm_swap_full() || ub_swap_full(mm_ub(mm)) ||
-			(vma->vm_flags & VM_LOCKED) || PageMlocked(page))
+	if (vm_swap_full() || (vma->vm_flags & VM_LOCKED) || PageMlocked(page))
 		try_to_free_swap(page);
 	unlock_page(page);
 	if (page != swapcache) {
-- 
1.7.10.4




More information about the Devel mailing list