[Devel] [PATCH RHEL7 COMMIT] ub: remove some dead code

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 25 03:26:41 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.5
------>
commit 2cd3d6168e3e3e76d0c3c8d6f501c73b56332154
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Mon May 25 14:26:40 2015 +0400

    ub: remove some dead code
    
    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 65d9de4..4833ef8 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 8cbf7d4..3b5a20f 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 5ec71da..5acbed3 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) {



More information about the Devel mailing list