Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
"Five fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
pps: do not crash when failed to register
tools/vm/slabinfo: fix an unintentional printf
testing/radix-tree: fix a macro expansion bug
radix-tree: fix radix_tree_iter_retry() for tagged iterators.
mm: memcontrol: fix cgroup creation failure after many small jobs

+92 -27
+1 -1
drivers/pps/clients/pps_parport.c
··· 195 195 struct pps_client_pp *device; 196 196 197 197 /* FIXME: oooh, this is ugly! */ 198 - if (strcmp(pardev->name, KBUILD_MODNAME)) 198 + if (!pardev || strcmp(pardev->name, KBUILD_MODNAME)) 199 199 /* not our port */ 200 200 return; 201 201
+10 -15
include/linux/memcontrol.h
··· 97 97 #define MEM_CGROUP_ID_SHIFT 16 98 98 #define MEM_CGROUP_ID_MAX USHRT_MAX 99 99 100 + struct mem_cgroup_id { 101 + int id; 102 + atomic_t ref; 103 + }; 104 + 100 105 struct mem_cgroup_stat_cpu { 101 106 long count[MEMCG_NR_STAT]; 102 107 unsigned long events[MEMCG_NR_EVENTS]; ··· 176 171 */ 177 172 struct mem_cgroup { 178 173 struct cgroup_subsys_state css; 174 + 175 + /* Private memcg ID. Used to ID objects that outlive the cgroup */ 176 + struct mem_cgroup_id id; 179 177 180 178 /* Accounted resources */ 181 179 struct page_counter memory; ··· 338 330 if (mem_cgroup_disabled()) 339 331 return 0; 340 332 341 - return memcg->css.id; 333 + return memcg->id.id; 342 334 } 343 - 344 - /** 345 - * mem_cgroup_from_id - look up a memcg from an id 346 - * @id: the id to look up 347 - * 348 - * Caller must hold rcu_read_lock() and use css_tryget() as necessary. 349 - */ 350 - static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id) 351 - { 352 - struct cgroup_subsys_state *css; 353 - 354 - css = css_from_id(id, &memory_cgrp_subsys); 355 - return mem_cgroup_from_css(css); 356 - } 335 + struct mem_cgroup *mem_cgroup_from_id(unsigned short id); 357 336 358 337 /** 359 338 * parent_mem_cgroup - find the accounting parent of a memcg
+1
include/linux/radix-tree.h
··· 407 407 void **radix_tree_iter_retry(struct radix_tree_iter *iter) 408 408 { 409 409 iter->next_index = iter->index; 410 + iter->tags = 0; 410 411 return NULL; 411 412 } 412 413
+75 -7
mm/memcontrol.c
··· 4057 4057 { }, /* terminate */ 4058 4058 }; 4059 4059 4060 + /* 4061 + * Private memory cgroup IDR 4062 + * 4063 + * Swap-out records and page cache shadow entries need to store memcg 4064 + * references in constrained space, so we maintain an ID space that is 4065 + * limited to 16 bit (MEM_CGROUP_ID_MAX), limiting the total number of 4066 + * memory-controlled cgroups to 64k. 4067 + * 4068 + * However, there usually are many references to the oflline CSS after 4069 + * the cgroup has been destroyed, such as page cache or reclaimable 4070 + * slab objects, that don't need to hang on to the ID. We want to keep 4071 + * those dead CSS from occupying IDs, or we might quickly exhaust the 4072 + * relatively small ID space and prevent the creation of new cgroups 4073 + * even when there are much fewer than 64k cgroups - possibly none. 4074 + * 4075 + * Maintain a private 16-bit ID space for memcg, and allow the ID to 4076 + * be freed and recycled when it's no longer needed, which is usually 4077 + * when the CSS is offlined. 4078 + * 4079 + * The only exception to that are records of swapped out tmpfs/shmem 4080 + * pages that need to be attributed to live ancestors on swapin. But 4081 + * those references are manageable from userspace. 4082 + */ 4083 + 4084 + static DEFINE_IDR(mem_cgroup_idr); 4085 + 4086 + static void mem_cgroup_id_get(struct mem_cgroup *memcg) 4087 + { 4088 + atomic_inc(&memcg->id.ref); 4089 + } 4090 + 4091 + static void mem_cgroup_id_put(struct mem_cgroup *memcg) 4092 + { 4093 + if (atomic_dec_and_test(&memcg->id.ref)) { 4094 + idr_remove(&mem_cgroup_idr, memcg->id.id); 4095 + memcg->id.id = 0; 4096 + 4097 + /* Memcg ID pins CSS */ 4098 + css_put(&memcg->css); 4099 + } 4100 + } 4101 + 4102 + /** 4103 + * mem_cgroup_from_id - look up a memcg from a memcg id 4104 + * @id: the memcg id to look up 4105 + * 4106 + * Caller must hold rcu_read_lock(). 4107 + */ 4108 + struct mem_cgroup *mem_cgroup_from_id(unsigned short id) 4109 + { 4110 + WARN_ON_ONCE(!rcu_read_lock_held()); 4111 + return idr_find(&mem_cgroup_idr, id); 4112 + } 4113 + 4060 4114 static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node) 4061 4115 { 4062 4116 struct mem_cgroup_per_node *pn; ··· 4170 4116 if (!memcg) 4171 4117 return NULL; 4172 4118 4119 + memcg->id.id = idr_alloc(&mem_cgroup_idr, NULL, 4120 + 1, MEM_CGROUP_ID_MAX, 4121 + GFP_KERNEL); 4122 + if (memcg->id.id < 0) 4123 + goto fail; 4124 + 4173 4125 memcg->stat = alloc_percpu(struct mem_cgroup_stat_cpu); 4174 4126 if (!memcg->stat) 4175 4127 goto fail; ··· 4202 4142 #ifdef CONFIG_CGROUP_WRITEBACK 4203 4143 INIT_LIST_HEAD(&memcg->cgwb_list); 4204 4144 #endif 4145 + idr_replace(&mem_cgroup_idr, memcg, memcg->id.id); 4205 4146 return memcg; 4206 4147 fail: 4148 + if (memcg->id.id > 0) 4149 + idr_remove(&mem_cgroup_idr, memcg->id.id); 4207 4150 mem_cgroup_free(memcg); 4208 4151 return NULL; 4209 4152 } ··· 4269 4206 return ERR_PTR(-ENOMEM); 4270 4207 } 4271 4208 4272 - static int 4273 - mem_cgroup_css_online(struct cgroup_subsys_state *css) 4209 + static int mem_cgroup_css_online(struct cgroup_subsys_state *css) 4274 4210 { 4275 - if (css->id > MEM_CGROUP_ID_MAX) 4276 - return -ENOSPC; 4277 - 4211 + /* Online state pins memcg ID, memcg ID pins CSS */ 4212 + mem_cgroup_id_get(mem_cgroup_from_css(css)); 4213 + css_get(css); 4278 4214 return 0; 4279 4215 } 4280 4216 ··· 4296 4234 4297 4235 memcg_offline_kmem(memcg); 4298 4236 wb_memcg_offline(memcg); 4237 + 4238 + mem_cgroup_id_put(memcg); 4299 4239 } 4300 4240 4301 4241 static void mem_cgroup_css_released(struct cgroup_subsys_state *css) ··· 5820 5756 if (!memcg) 5821 5757 return; 5822 5758 5759 + mem_cgroup_id_get(memcg); 5823 5760 oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg)); 5824 5761 VM_BUG_ON_PAGE(oldid, page); 5825 5762 mem_cgroup_swap_statistics(memcg, true); ··· 5839 5774 VM_BUG_ON(!irqs_disabled()); 5840 5775 mem_cgroup_charge_statistics(memcg, page, false, -1); 5841 5776 memcg_check_events(memcg, page); 5777 + 5778 + if (!mem_cgroup_is_root(memcg)) 5779 + css_put(&memcg->css); 5842 5780 } 5843 5781 5844 5782 /* ··· 5872 5804 !page_counter_try_charge(&memcg->swap, 1, &counter)) 5873 5805 return -ENOMEM; 5874 5806 5807 + mem_cgroup_id_get(memcg); 5875 5808 oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg)); 5876 5809 VM_BUG_ON_PAGE(oldid, page); 5877 5810 mem_cgroup_swap_statistics(memcg, true); 5878 5811 5879 - css_get(&memcg->css); 5880 5812 return 0; 5881 5813 } 5882 5814 ··· 5905 5837 page_counter_uncharge(&memcg->memsw, 1); 5906 5838 } 5907 5839 mem_cgroup_swap_statistics(memcg, false); 5908 - css_put(&memcg->css); 5840 + mem_cgroup_id_put(memcg); 5909 5841 } 5910 5842 rcu_read_unlock(); 5911 5843 }
+2 -2
mm/slab_common.c
··· 526 526 goto out_unlock; 527 527 528 528 cgroup_name(css->cgroup, memcg_name_buf, sizeof(memcg_name_buf)); 529 - cache_name = kasprintf(GFP_KERNEL, "%s(%d:%s)", root_cache->name, 530 - css->id, memcg_name_buf); 529 + cache_name = kasprintf(GFP_KERNEL, "%s(%llu:%s)", root_cache->name, 530 + css->serial_nr, memcg_name_buf); 531 531 if (!cache_name) 532 532 goto out_unlock; 533 533
+1 -1
tools/testing/radix-tree/tag_check.c
··· 122 122 NODE_TAGGED = 2, 123 123 }; 124 124 125 - #define THRASH_SIZE 1000 * 1000 125 + #define THRASH_SIZE (1000 * 1000) 126 126 #define N 127 127 127 #define BATCH 33 128 128
+2 -1
tools/vm/slabinfo.c
··· 510 510 s->alloc_node_mismatch, (s->alloc_node_mismatch * 100) / total); 511 511 } 512 512 513 - if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) 513 + if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) { 514 514 printf("\nCmpxchg_double Looping\n------------------------\n"); 515 515 printf("Locked Cmpxchg Double redos %lu\nUnlocked Cmpxchg Double redos %lu\n", 516 516 s->cmpxchg_double_fail, s->cmpxchg_double_cpu_fail); 517 + } 517 518 } 518 519 519 520 static void report(struct slabinfo *s)