aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>2010-08-10 21:02:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:18 -0400
commitbd0d24bfe8a8f8d2400569740874a67d164d40a9 (patch)
tree9d592f6566adacc3e8da3d2c06411a16b2d45763
parent2bd9bb206b338888b226e70139a25a67d10007f0 (diff)
memcg: remove redundant code
- try_get_mem_cgroup_from_mm() calls rcu_read_lock/unlock by itself, so we don't have to call them in task_in_mem_cgroup(). - *mz is not used in __mem_cgroup_uncharge_common(). - we don't have to call lookup_page_cgroup() in mem_cgroup_end_migration() after we've cleared PCG_MIGRATION of @oldpage. - remove empty comment. - remove redundant empty line in mem_cgroup_cache_charge(). Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memcontrol.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 27981e705b0a..79a53f0f0cf5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -840,9 +840,7 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
840 struct mem_cgroup *curr = NULL; 840 struct mem_cgroup *curr = NULL;
841 841
842 task_lock(task); 842 task_lock(task);
843 rcu_read_lock();
844 curr = try_get_mem_cgroup_from_mm(task->mm); 843 curr = try_get_mem_cgroup_from_mm(task->mm);
845 rcu_read_unlock();
846 task_unlock(task); 844 task_unlock(task);
847 if (!curr) 845 if (!curr)
848 return 0; 846 return 0;
@@ -2092,7 +2090,6 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
2092 if (!(gfp_mask & __GFP_WAIT)) { 2090 if (!(gfp_mask & __GFP_WAIT)) {
2093 struct page_cgroup *pc; 2091 struct page_cgroup *pc;
2094 2092
2095
2096 pc = lookup_page_cgroup(page); 2093 pc = lookup_page_cgroup(page);
2097 if (!pc) 2094 if (!pc)
2098 return 0; 2095 return 0;
@@ -2286,7 +2283,6 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
2286{ 2283{
2287 struct page_cgroup *pc; 2284 struct page_cgroup *pc;
2288 struct mem_cgroup *mem = NULL; 2285 struct mem_cgroup *mem = NULL;
2289 struct mem_cgroup_per_zone *mz;
2290 2286
2291 if (mem_cgroup_disabled()) 2287 if (mem_cgroup_disabled())
2292 return NULL; 2288 return NULL;
@@ -2340,7 +2336,6 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
2340 * special functions. 2336 * special functions.
2341 */ 2337 */
2342 2338
2343 mz = page_cgroup_zoneinfo(pc);
2344 unlock_page_cgroup(pc); 2339 unlock_page_cgroup(pc);
2345 2340
2346 memcg_check_events(mem, page); 2341 memcg_check_events(mem, page);
@@ -2652,11 +2647,8 @@ void mem_cgroup_end_migration(struct mem_cgroup *mem,
2652 ClearPageCgroupMigration(pc); 2647 ClearPageCgroupMigration(pc);
2653 unlock_page_cgroup(pc); 2648 unlock_page_cgroup(pc);
2654 2649
2655 if (unused != oldpage)
2656 pc = lookup_page_cgroup(unused);
2657 __mem_cgroup_uncharge_common(unused, MEM_CGROUP_CHARGE_TYPE_FORCE); 2650 __mem_cgroup_uncharge_common(unused, MEM_CGROUP_CHARGE_TYPE_FORCE);
2658 2651
2659 pc = lookup_page_cgroup(used);
2660 /* 2652 /*
2661 * If a page is a file cache, radix-tree replacement is very atomic 2653 * If a page is a file cache, radix-tree replacement is very atomic
2662 * and we can skip this check. When it was an Anon page, its mapcount 2654 * and we can skip this check. When it was an Anon page, its mapcount
@@ -3800,8 +3792,6 @@ static int mem_cgroup_oom_control_read(struct cgroup *cgrp,
3800 return 0; 3792 return 0;
3801} 3793}
3802 3794
3803/*
3804 */
3805static int mem_cgroup_oom_control_write(struct cgroup *cgrp, 3795static int mem_cgroup_oom_control_write(struct cgroup *cgrp,
3806 struct cftype *cft, u64 val) 3796 struct cftype *cft, u64 val)
3807{ 3797{
ping: Fix the address space annotations' href='/cgit/cgit.cgi/litmus-rt-budgetable-locks.git/.git/commit/include/linux/io-mapping.h?h=update_litmus_2019&id=29bc17ecb856ffb2b47c7009a71971c6f9334205'>29bc17ecb856
9663f2e6a6cf


29bc17ecb856
fca3ec01e0b4
3e4d3af501cc
9663f2e6a6cf
24dd85ff723f
29bc17ecb856
9663f2e6a6cf


3e4d3af501cc
9663f2e6a6cf
24dd85ff723f
9663f2e6a6cf

e5beae169017
29bc17ecb856
9663f2e6a6cf

29bc17ecb856
9663f2e6a6cf


29bc17ecb856
9663f2e6a6cf
9663f2e6a6cf
e5beae169017

9663f2e6a6cf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168




















                                                                          
                       
                      

                     




                                                                         
                                   

   

                               

                      





                             





                                                          
 
                                 
                                                              
 
                                 
                      


                                                    



                                               


                           
                           
                     




                     




                                           
                                                 
                       


                      
                            
                                                    
                                              
 





                                                        
                                                         


                  
                                            
 
                              

 
                            

                                                                   

                                  
                                        

                                           
                                                


                  
                                     
 
                       

 
     
 

                          


                                                 
                                 
                                 
                                                              
 
                                                                    




                                           
                                                  


                      
                            
                                                    
                                              
 
                            
                                                           


                  
                                            
 
                           

 
                          
                            

                                                                   
                                                           


                  
                                     
 
 

                              

                                
/*
 * Copyright © 2008 Keith Packard <keithp@keithp.com>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef _LINUX_IO_MAPPING_H
#define _LINUX_IO_MAPPING_H

#include <linux/types.h>
#include <linux/slab.h>
#include <linux/bug.h>
#include <asm/io.h>
#include <asm/page.h>

/*
 * The io_mapping mechanism provides an abstraction for mapping
 * individual pages from an io device to the CPU in an efficient fashion.
 *
 * See Documentation/io-mapping.txt
 */

#ifdef CONFIG_HAVE_ATOMIC_IOMAP

#include <asm/iomap.h>

struct io_mapping {
	resource_size_t base;
	unsigned long size;
	pgprot_t prot;
};

/*
 * For small address space machines, mapping large objects
 * into the kernel virtual space isn't practical. Where
 * available, use fixmap support to dynamically map pages
 * of the object at run time.
 */

static inline struct io_mapping *
io_mapping_create_wc(resource_size_t base, unsigned long size)
{
	struct io_mapping *iomap;
	pgprot_t prot;

	iomap = kmalloc(sizeof(*iomap), GFP_KERNEL);
	if (!iomap)
		goto out_err;

	if (iomap_create_wc(base, size, &prot))
		goto out_free;

	iomap->base = base;
	iomap->size = size;
	iomap->prot = prot;
	return iomap;

out_free:
	kfree(iomap);
out_err:
	return NULL;
}

static inline void
io_mapping_free(struct io_mapping *mapping)
{
	iomap_free(mapping->base, mapping->size);
	kfree(mapping);
}

/* Atomic map/unmap */
static inline void __iomem *
io_mapping_map_atomic_wc(struct io_mapping *mapping,
			 unsigned long offset)
{
	resource_size_t phys_addr;
	unsigned long pfn;

	BUG_ON(offset >= mapping->size);
	phys_addr = mapping->base + offset;
	pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
	return iomap_atomic_prot_pfn(pfn, mapping->prot);
}

static inline void
io_mapping_unmap_atomic(void __iomem *vaddr)
{
	iounmap_atomic(vaddr);
}

static inline void __iomem *
io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
{
	resource_size_t phys_addr;

	BUG_ON(offset >= mapping->size);
	phys_addr = mapping->base + offset;

	return ioremap_wc(phys_addr, PAGE_SIZE);
}

static inline void
io_mapping_unmap(void __iomem *vaddr)
{
	iounmap(vaddr);
}

#else

#include <linux/uaccess.h>

/* this struct isn't actually defined anywhere */
struct io_mapping;

/* Create the io_mapping object*/
static inline struct io_mapping *
io_mapping_create_wc(resource_size_t base, unsigned long size)
{
	return (struct io_mapping __force *) ioremap_wc(base, size);
}

static inline void
io_mapping_free(struct io_mapping *mapping)
{
	iounmap((void __force __iomem *) mapping);
}

/* Atomic map/unmap */
static inline void __iomem *
io_mapping_map_atomic_wc(struct io_mapping *mapping,
			 unsigned long offset)
{
	pagefault_disable();
	return ((char __force __iomem *) mapping) + offset;
}

static inline void
io_mapping_unmap_atomic(void __iomem *vaddr)
{
	pagefault_enable();
}

/* Non-atomic map/unmap */
static inline void __iomem *
io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
{
	return ((char __force __iomem *) mapping) + offset;
}

static inline void
io_mapping_unmap(void __iomem *vaddr)
{
}

#endif /* HAVE_ATOMIC_IOMAP */

#endif /* _LINUX_IO_MAPPING_H */