mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "20 fixes" * emailed patches from Andrew Morton <[email protected]>: drivers/misc/sgi-gru/grumain.c: remove bogus 0x prefix from printk cris/arch-v32: cryptocop: print a hex number after a 0x prefix ipack: print a hex number after a 0x prefix block: DAC960: print a hex number after a 0x prefix fs: exofs: print a hex number after a 0x prefix lib/genalloc.c: start search from start of chunk mm: memcontrol: do not recurse in direct reclaim CREDITS: update credit information for Martin Kepplinger proc: fix NULL dereference when reading /proc/<pid>/auxv mm: kmemleak: ensure that the task stack is not freed during scanning lib/stackdepot.c: bump stackdepot capacity from 16MB to 128MB latent_entropy: raise CONFIG_FRAME_WARN by default kconfig.h: remove config_enabled() macro ipc: account for kmem usage on mqueue and msg mm/slab: improve performance of gathering slabinfo stats mm: page_alloc: use KERN_CONT where appropriate mm/list_lru.c: avoid error-path NULL pointer deref h8300: fix syscall restarting kcov: properly check if we are in an interrupt mm/slab: fix kmemcg cache creation delayed issue
This commit is contained in:
commit
14970f204b
24 changed files with 89 additions and 51 deletions
|
|
@ -1453,8 +1453,11 @@ static void kmemleak_scan(void)
|
|||
|
||||
read_lock(&tasklist_lock);
|
||||
do_each_thread(g, p) {
|
||||
scan_block(task_stack_page(p), task_stack_page(p) +
|
||||
THREAD_SIZE, NULL);
|
||||
void *stack = try_get_task_stack(p);
|
||||
if (stack) {
|
||||
scan_block(stack, stack + THREAD_SIZE, NULL);
|
||||
put_task_stack(p);
|
||||
}
|
||||
} while_each_thread(g, p);
|
||||
read_unlock(&tasklist_lock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,6 +554,8 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware,
|
|||
err = memcg_init_list_lru(lru, memcg_aware);
|
||||
if (err) {
|
||||
kfree(lru->node);
|
||||
/* Do this so a list_lru_destroy() doesn't crash: */
|
||||
lru->node = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1917,6 +1917,15 @@ retry:
|
|||
current->flags & PF_EXITING))
|
||||
goto force;
|
||||
|
||||
/*
|
||||
* Prevent unbounded recursion when reclaim operations need to
|
||||
* allocate memory. This might exceed the limits temporarily,
|
||||
* but we prefer facilitating memory reclaim and getting back
|
||||
* under the limit over triggering OOM kills in these cases.
|
||||
*/
|
||||
if (unlikely(current->flags & PF_MEMALLOC))
|
||||
goto force;
|
||||
|
||||
if (unlikely(task_in_memcg_oom(current)))
|
||||
goto nomem;
|
||||
|
||||
|
|
|
|||
|
|
@ -4224,7 +4224,7 @@ static void show_migration_types(unsigned char type)
|
|||
}
|
||||
|
||||
*p = '\0';
|
||||
printk("(%s) ", tmp);
|
||||
printk(KERN_CONT "(%s) ", tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -4335,7 +4335,8 @@ void show_free_areas(unsigned int filter)
|
|||
free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
|
||||
|
||||
show_node(zone);
|
||||
printk("%s"
|
||||
printk(KERN_CONT
|
||||
"%s"
|
||||
" free:%lukB"
|
||||
" min:%lukB"
|
||||
" low:%lukB"
|
||||
|
|
@ -4382,8 +4383,8 @@ void show_free_areas(unsigned int filter)
|
|||
K(zone_page_state(zone, NR_FREE_CMA_PAGES)));
|
||||
printk("lowmem_reserve[]:");
|
||||
for (i = 0; i < MAX_NR_ZONES; i++)
|
||||
printk(" %ld", zone->lowmem_reserve[i]);
|
||||
printk("\n");
|
||||
printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
|
||||
for_each_populated_zone(zone) {
|
||||
|
|
@ -4394,7 +4395,7 @@ void show_free_areas(unsigned int filter)
|
|||
if (skip_free_areas_node(filter, zone_to_nid(zone)))
|
||||
continue;
|
||||
show_node(zone);
|
||||
printk("%s: ", zone->name);
|
||||
printk(KERN_CONT "%s: ", zone->name);
|
||||
|
||||
spin_lock_irqsave(&zone->lock, flags);
|
||||
for (order = 0; order < MAX_ORDER; order++) {
|
||||
|
|
@ -4412,11 +4413,12 @@ void show_free_areas(unsigned int filter)
|
|||
}
|
||||
spin_unlock_irqrestore(&zone->lock, flags);
|
||||
for (order = 0; order < MAX_ORDER; order++) {
|
||||
printk("%lu*%lukB ", nr[order], K(1UL) << order);
|
||||
printk(KERN_CONT "%lu*%lukB ",
|
||||
nr[order], K(1UL) << order);
|
||||
if (nr[order])
|
||||
show_migration_types(types[order]);
|
||||
}
|
||||
printk("= %lukB\n", K(total));
|
||||
printk(KERN_CONT "= %lukB\n", K(total));
|
||||
}
|
||||
|
||||
hugetlb_show_meminfo();
|
||||
|
|
|
|||
45
mm/slab.c
45
mm/slab.c
|
|
@ -233,6 +233,7 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent)
|
|||
spin_lock_init(&parent->list_lock);
|
||||
parent->free_objects = 0;
|
||||
parent->free_touched = 0;
|
||||
parent->num_slabs = 0;
|
||||
}
|
||||
|
||||
#define MAKE_LIST(cachep, listp, slab, nodeid) \
|
||||
|
|
@ -966,7 +967,7 @@ static int setup_kmem_cache_node(struct kmem_cache *cachep,
|
|||
* guaranteed to be valid until irq is re-enabled, because it will be
|
||||
* freed after synchronize_sched().
|
||||
*/
|
||||
if (force_change)
|
||||
if (old_shared && force_change)
|
||||
synchronize_sched();
|
||||
|
||||
fail:
|
||||
|
|
@ -1382,24 +1383,27 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
|
|||
for_each_kmem_cache_node(cachep, node, n) {
|
||||
unsigned long active_objs = 0, num_objs = 0, free_objects = 0;
|
||||
unsigned long active_slabs = 0, num_slabs = 0;
|
||||
unsigned long num_slabs_partial = 0, num_slabs_free = 0;
|
||||
unsigned long num_slabs_full;
|
||||
|
||||
spin_lock_irqsave(&n->list_lock, flags);
|
||||
list_for_each_entry(page, &n->slabs_full, lru) {
|
||||
active_objs += cachep->num;
|
||||
active_slabs++;
|
||||
}
|
||||
num_slabs = n->num_slabs;
|
||||
list_for_each_entry(page, &n->slabs_partial, lru) {
|
||||
active_objs += page->active;
|
||||
active_slabs++;
|
||||
num_slabs_partial++;
|
||||
}
|
||||
list_for_each_entry(page, &n->slabs_free, lru)
|
||||
num_slabs++;
|
||||
num_slabs_free++;
|
||||
|
||||
free_objects += n->free_objects;
|
||||
spin_unlock_irqrestore(&n->list_lock, flags);
|
||||
|
||||
num_slabs += active_slabs;
|
||||
num_objs = num_slabs * cachep->num;
|
||||
active_slabs = num_slabs - num_slabs_free;
|
||||
num_slabs_full = num_slabs -
|
||||
(num_slabs_partial + num_slabs_free);
|
||||
active_objs += (num_slabs_full * cachep->num);
|
||||
|
||||
pr_warn(" node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n",
|
||||
node, active_slabs, num_slabs, active_objs, num_objs,
|
||||
free_objects);
|
||||
|
|
@ -2314,6 +2318,7 @@ static int drain_freelist(struct kmem_cache *cache,
|
|||
|
||||
page = list_entry(p, struct page, lru);
|
||||
list_del(&page->lru);
|
||||
n->num_slabs--;
|
||||
/*
|
||||
* Safe to drop the lock. The slab is no longer linked
|
||||
* to the cache.
|
||||
|
|
@ -2752,6 +2757,8 @@ static void cache_grow_end(struct kmem_cache *cachep, struct page *page)
|
|||
list_add_tail(&page->lru, &(n->slabs_free));
|
||||
else
|
||||
fixup_slab_list(cachep, n, page, &list);
|
||||
|
||||
n->num_slabs++;
|
||||
STATS_INC_GROWN(cachep);
|
||||
n->free_objects += cachep->num - page->active;
|
||||
spin_unlock(&n->list_lock);
|
||||
|
|
@ -3443,6 +3450,7 @@ static void free_block(struct kmem_cache *cachep, void **objpp,
|
|||
|
||||
page = list_last_entry(&n->slabs_free, struct page, lru);
|
||||
list_move(&page->lru, list);
|
||||
n->num_slabs--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4099,6 +4107,8 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo)
|
|||
unsigned long num_objs;
|
||||
unsigned long active_slabs = 0;
|
||||
unsigned long num_slabs, free_objects = 0, shared_avail = 0;
|
||||
unsigned long num_slabs_partial = 0, num_slabs_free = 0;
|
||||
unsigned long num_slabs_full = 0;
|
||||
const char *name;
|
||||
char *error = NULL;
|
||||
int node;
|
||||
|
|
@ -4111,33 +4121,34 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo)
|
|||
check_irq_on();
|
||||
spin_lock_irq(&n->list_lock);
|
||||
|
||||
list_for_each_entry(page, &n->slabs_full, lru) {
|
||||
if (page->active != cachep->num && !error)
|
||||
error = "slabs_full accounting error";
|
||||
active_objs += cachep->num;
|
||||
active_slabs++;
|
||||
}
|
||||
num_slabs += n->num_slabs;
|
||||
|
||||
list_for_each_entry(page, &n->slabs_partial, lru) {
|
||||
if (page->active == cachep->num && !error)
|
||||
error = "slabs_partial accounting error";
|
||||
if (!page->active && !error)
|
||||
error = "slabs_partial accounting error";
|
||||
active_objs += page->active;
|
||||
active_slabs++;
|
||||
num_slabs_partial++;
|
||||
}
|
||||
|
||||
list_for_each_entry(page, &n->slabs_free, lru) {
|
||||
if (page->active && !error)
|
||||
error = "slabs_free accounting error";
|
||||
num_slabs++;
|
||||
num_slabs_free++;
|
||||
}
|
||||
|
||||
free_objects += n->free_objects;
|
||||
if (n->shared)
|
||||
shared_avail += n->shared->avail;
|
||||
|
||||
spin_unlock_irq(&n->list_lock);
|
||||
}
|
||||
num_slabs += active_slabs;
|
||||
num_objs = num_slabs * cachep->num;
|
||||
active_slabs = num_slabs - num_slabs_free;
|
||||
num_slabs_full = num_slabs - (num_slabs_partial + num_slabs_free);
|
||||
active_objs += (num_slabs_full * cachep->num);
|
||||
|
||||
if (num_objs - active_objs != free_objects && !error)
|
||||
error = "free_objects accounting error";
|
||||
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ struct kmem_cache_node {
|
|||
struct list_head slabs_partial; /* partial list first, better asm code */
|
||||
struct list_head slabs_full;
|
||||
struct list_head slabs_free;
|
||||
unsigned long num_slabs;
|
||||
unsigned long free_objects;
|
||||
unsigned int free_limit;
|
||||
unsigned int colour_next; /* Per-node cache coloring */
|
||||
|
|
|
|||
|
|
@ -3043,7 +3043,9 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
|
|||
sc.gfp_mask,
|
||||
sc.reclaim_idx);
|
||||
|
||||
current->flags |= PF_MEMALLOC;
|
||||
nr_reclaimed = do_try_to_free_pages(zonelist, &sc);
|
||||
current->flags &= ~PF_MEMALLOC;
|
||||
|
||||
trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue