mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 14:13:01 -04:00
Merge branch 'akpm' (patches from Andrew)
Merge third set of updates from Andrew Morton:
- the rest of MM
[ This includes getting rid of the numa hinting bits, in favor of
just generic protnone logic. Yay. - Linus ]
- core kernel
- procfs
- some of lib/ (lots of lib/ material this time)
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (104 commits)
lib/lcm.c: replace include
lib/percpu_ida.c: remove redundant includes
lib/strncpy_from_user.c: replace module.h include
lib/stmp_device.c: replace module.h include
lib/sort.c: move include inside #if 0
lib/show_mem.c: remove redundant include
lib/radix-tree.c: change to simpler include
lib/plist.c: remove redundant include
lib/nlattr.c: remove redundant include
lib/kobject_uevent.c: remove redundant include
lib/llist.c: remove redundant include
lib/md5.c: simplify include
lib/list_sort.c: rearrange includes
lib/genalloc.c: remove redundant include
lib/idr.c: remove redundant include
lib/halfmd4.c: simplify includes
lib/dynamic_queue_limits.c: simplify includes
lib/sort.c: use simpler includes
lib/interval_tree.c: simplify includes
hexdump: make it return number of bytes placed in buffer
...
This commit is contained in:
commit
818099574b
207 changed files with 2214 additions and 1420 deletions
|
|
@ -160,18 +160,18 @@ extern int bitmap_parselist(const char *buf, unsigned long *maskp,
|
|||
extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen,
|
||||
unsigned long *dst, int nbits);
|
||||
extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
|
||||
const unsigned long *old, const unsigned long *new, int bits);
|
||||
const unsigned long *old, const unsigned long *new, unsigned int nbits);
|
||||
extern int bitmap_bitremap(int oldbit,
|
||||
const unsigned long *old, const unsigned long *new, int bits);
|
||||
extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
|
||||
const unsigned long *relmap, int bits);
|
||||
const unsigned long *relmap, unsigned int bits);
|
||||
extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
|
||||
int sz, int bits);
|
||||
unsigned int sz, unsigned int nbits);
|
||||
extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
|
||||
extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
|
||||
extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
|
||||
extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
|
||||
extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
|
||||
extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits);
|
||||
extern int bitmap_print_to_pagebuf(bool list, char *buf,
|
||||
const unsigned long *maskp, int nmaskbits);
|
||||
|
||||
|
|
@ -185,33 +185,33 @@ extern int bitmap_print_to_pagebuf(bool list, char *buf,
|
|||
#define small_const_nbits(nbits) \
|
||||
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
||||
|
||||
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
||||
static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
|
||||
{
|
||||
if (small_const_nbits(nbits))
|
||||
*dst = 0UL;
|
||||
else {
|
||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memset(dst, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bitmap_fill(unsigned long *dst, int nbits)
|
||||
static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
|
||||
{
|
||||
size_t nlongs = BITS_TO_LONGS(nbits);
|
||||
unsigned int nlongs = BITS_TO_LONGS(nbits);
|
||||
if (!small_const_nbits(nbits)) {
|
||||
int len = (nlongs - 1) * sizeof(unsigned long);
|
||||
unsigned int len = (nlongs - 1) * sizeof(unsigned long);
|
||||
memset(dst, 0xff, len);
|
||||
}
|
||||
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
||||
int nbits)
|
||||
unsigned int nbits)
|
||||
{
|
||||
if (small_const_nbits(nbits))
|
||||
*dst = *src;
|
||||
else {
|
||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memcpy(dst, src, len);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -905,13 +905,13 @@ static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
|
|||
}
|
||||
|
||||
#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
|
||||
static inline void __cpus_setall(cpumask_t *dstp, int nbits)
|
||||
static inline void __cpus_setall(cpumask_t *dstp, unsigned int nbits)
|
||||
{
|
||||
bitmap_fill(dstp->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
|
||||
static inline void __cpus_clear(cpumask_t *dstp, int nbits)
|
||||
static inline void __cpus_clear(cpumask_t *dstp, unsigned int nbits)
|
||||
{
|
||||
bitmap_zero(dstp->bits, nbits);
|
||||
}
|
||||
|
|
@ -927,21 +927,21 @@ static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
|
|||
|
||||
#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
|
||||
static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
|
||||
static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
|
||||
static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -949,40 +949,40 @@ static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
|
|||
#define cpus_andnot(dst, src1, src2) \
|
||||
__cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
|
||||
static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
|
||||
static inline int __cpus_equal(const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_equal(src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
|
||||
static inline int __cpus_intersects(const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_intersects(src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
|
||||
static inline int __cpus_subset(const cpumask_t *src1p,
|
||||
const cpumask_t *src2p, int nbits)
|
||||
const cpumask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_subset(src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
|
||||
static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
|
||||
static inline int __cpus_empty(const cpumask_t *srcp, unsigned int nbits)
|
||||
{
|
||||
return bitmap_empty(srcp->bits, nbits);
|
||||
}
|
||||
|
||||
#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
|
||||
static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
|
||||
static inline int __cpus_weight(const cpumask_t *srcp, unsigned int nbits)
|
||||
{
|
||||
return bitmap_weight(srcp->bits, nbits);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __CRYPTOHASH_H
|
||||
#define __CRYPTOHASH_H
|
||||
|
||||
#include <uapi/linux/types.h>
|
||||
|
||||
#define SHA_DIGEST_WORDS 5
|
||||
#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8)
|
||||
#define SHA_WORKSPACE_WORDS 16
|
||||
|
|
|
|||
|
|
@ -1655,8 +1655,10 @@ struct super_operations {
|
|||
struct dquot **(*get_dquots)(struct inode *);
|
||||
#endif
|
||||
int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
|
||||
long (*nr_cached_objects)(struct super_block *, int);
|
||||
long (*free_cached_objects)(struct super_block *, long, int);
|
||||
long (*nr_cached_objects)(struct super_block *,
|
||||
struct shrink_control *);
|
||||
long (*free_cached_objects)(struct super_block *,
|
||||
struct shrink_control *);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -193,6 +193,9 @@ extern struct task_group root_task_group;
|
|||
.nr_cpus_allowed= NR_CPUS, \
|
||||
.mm = NULL, \
|
||||
.active_mm = &init_mm, \
|
||||
.restart_block = { \
|
||||
.fn = do_no_restart_syscall, \
|
||||
}, \
|
||||
.se = { \
|
||||
.group_node = LIST_HEAD_INIT(tsk.se.group_node), \
|
||||
}, \
|
||||
|
|
|
|||
|
|
@ -800,9 +800,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
|
|||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
|
||||
/* Trap pasters of __FUNCTION__ at compile-time */
|
||||
#define __FUNCTION__ (__func__)
|
||||
|
||||
/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
|
||||
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
|
||||
# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
#include <linux/list.h>
|
||||
#include <linux/nodemask.h>
|
||||
#include <linux/shrinker.h>
|
||||
|
||||
struct mem_cgroup;
|
||||
|
||||
/* list_lru_walk_cb has to always return one of those */
|
||||
enum lru_status {
|
||||
|
|
@ -21,24 +24,45 @@ enum lru_status {
|
|||
internally, but has to return locked. */
|
||||
};
|
||||
|
||||
struct list_lru_node {
|
||||
spinlock_t lock;
|
||||
struct list_lru_one {
|
||||
struct list_head list;
|
||||
/* kept as signed so we can catch imbalance bugs */
|
||||
/* may become negative during memcg reparenting */
|
||||
long nr_items;
|
||||
};
|
||||
|
||||
struct list_lru_memcg {
|
||||
/* array of per cgroup lists, indexed by memcg_cache_id */
|
||||
struct list_lru_one *lru[0];
|
||||
};
|
||||
|
||||
struct list_lru_node {
|
||||
/* protects all lists on the node, including per cgroup */
|
||||
spinlock_t lock;
|
||||
/* global list, used for the root cgroup in cgroup aware lrus */
|
||||
struct list_lru_one lru;
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
/* for cgroup aware lrus points to per cgroup lists, otherwise NULL */
|
||||
struct list_lru_memcg *memcg_lrus;
|
||||
#endif
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
struct list_lru {
|
||||
struct list_lru_node *node;
|
||||
nodemask_t active_nodes;
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
struct list_head list;
|
||||
#endif
|
||||
};
|
||||
|
||||
void list_lru_destroy(struct list_lru *lru);
|
||||
int list_lru_init_key(struct list_lru *lru, struct lock_class_key *key);
|
||||
static inline int list_lru_init(struct list_lru *lru)
|
||||
{
|
||||
return list_lru_init_key(lru, NULL);
|
||||
}
|
||||
int __list_lru_init(struct list_lru *lru, bool memcg_aware,
|
||||
struct lock_class_key *key);
|
||||
|
||||
#define list_lru_init(lru) __list_lru_init((lru), false, NULL)
|
||||
#define list_lru_init_key(lru, key) __list_lru_init((lru), false, (key))
|
||||
#define list_lru_init_memcg(lru) __list_lru_init((lru), true, NULL)
|
||||
|
||||
int memcg_update_all_list_lrus(int num_memcgs);
|
||||
void memcg_drain_all_list_lrus(int src_idx, int dst_idx);
|
||||
|
||||
/**
|
||||
* list_lru_add: add an element to the lru list's tail
|
||||
|
|
@ -72,32 +96,48 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item);
|
|||
bool list_lru_del(struct list_lru *lru, struct list_head *item);
|
||||
|
||||
/**
|
||||
* list_lru_count_node: return the number of objects currently held by @lru
|
||||
* list_lru_count_one: return the number of objects currently held by @lru
|
||||
* @lru: the lru pointer.
|
||||
* @nid: the node id to count from.
|
||||
* @memcg: the cgroup to count from.
|
||||
*
|
||||
* Always return a non-negative number, 0 for empty lists. There is no
|
||||
* guarantee that the list is not updated while the count is being computed.
|
||||
* Callers that want such a guarantee need to provide an outer lock.
|
||||
*/
|
||||
unsigned long list_lru_count_one(struct list_lru *lru,
|
||||
int nid, struct mem_cgroup *memcg);
|
||||
unsigned long list_lru_count_node(struct list_lru *lru, int nid);
|
||||
|
||||
static inline unsigned long list_lru_shrink_count(struct list_lru *lru,
|
||||
struct shrink_control *sc)
|
||||
{
|
||||
return list_lru_count_one(lru, sc->nid, sc->memcg);
|
||||
}
|
||||
|
||||
static inline unsigned long list_lru_count(struct list_lru *lru)
|
||||
{
|
||||
long count = 0;
|
||||
int nid;
|
||||
|
||||
for_each_node_mask(nid, lru->active_nodes)
|
||||
for_each_node_state(nid, N_NORMAL_MEMORY)
|
||||
count += list_lru_count_node(lru, nid);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
typedef enum lru_status
|
||||
(*list_lru_walk_cb)(struct list_head *item, spinlock_t *lock, void *cb_arg);
|
||||
void list_lru_isolate(struct list_lru_one *list, struct list_head *item);
|
||||
void list_lru_isolate_move(struct list_lru_one *list, struct list_head *item,
|
||||
struct list_head *head);
|
||||
|
||||
typedef enum lru_status (*list_lru_walk_cb)(struct list_head *item,
|
||||
struct list_lru_one *list, spinlock_t *lock, void *cb_arg);
|
||||
|
||||
/**
|
||||
* list_lru_walk_node: walk a list_lru, isolating and disposing freeable items.
|
||||
* list_lru_walk_one: walk a list_lru, isolating and disposing freeable items.
|
||||
* @lru: the lru pointer.
|
||||
* @nid: the node id to scan from.
|
||||
* @memcg: the cgroup to scan from.
|
||||
* @isolate: callback function that is resposible for deciding what to do with
|
||||
* the item currently being scanned
|
||||
* @cb_arg: opaque type that will be passed to @isolate
|
||||
|
|
@ -115,10 +155,22 @@ typedef enum lru_status
|
|||
*
|
||||
* Return value: the number of objects effectively removed from the LRU.
|
||||
*/
|
||||
unsigned long list_lru_walk_one(struct list_lru *lru,
|
||||
int nid, struct mem_cgroup *memcg,
|
||||
list_lru_walk_cb isolate, void *cb_arg,
|
||||
unsigned long *nr_to_walk);
|
||||
unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
|
||||
list_lru_walk_cb isolate, void *cb_arg,
|
||||
unsigned long *nr_to_walk);
|
||||
|
||||
static inline unsigned long
|
||||
list_lru_shrink_walk(struct list_lru *lru, struct shrink_control *sc,
|
||||
list_lru_walk_cb isolate, void *cb_arg)
|
||||
{
|
||||
return list_lru_walk_one(lru, sc->nid, sc->memcg, isolate, cb_arg,
|
||||
&sc->nr_to_scan);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
|
||||
void *cb_arg, unsigned long nr_to_walk)
|
||||
|
|
@ -126,7 +178,7 @@ list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
|
|||
long isolated = 0;
|
||||
int nid;
|
||||
|
||||
for_each_node_mask(nid, lru->active_nodes) {
|
||||
for_each_node_state(nid, N_NORMAL_MEMORY) {
|
||||
isolated += list_lru_walk_node(lru, nid, isolate,
|
||||
cb_arg, &nr_to_walk);
|
||||
if (nr_to_walk <= 0)
|
||||
|
|
|
|||
|
|
@ -398,7 +398,9 @@ static inline void sock_release_memcg(struct sock *sk)
|
|||
#ifdef CONFIG_MEMCG_KMEM
|
||||
extern struct static_key memcg_kmem_enabled_key;
|
||||
|
||||
extern int memcg_limited_groups_array_size;
|
||||
extern int memcg_nr_cache_ids;
|
||||
extern void memcg_get_cache_ids(void);
|
||||
extern void memcg_put_cache_ids(void);
|
||||
|
||||
/*
|
||||
* Helper macro to loop through all memcg-specific caches. Callers must still
|
||||
|
|
@ -406,13 +408,15 @@ extern int memcg_limited_groups_array_size;
|
|||
* the slab_mutex must be held when looping through those caches
|
||||
*/
|
||||
#define for_each_memcg_cache_index(_idx) \
|
||||
for ((_idx) = 0; (_idx) < memcg_limited_groups_array_size; (_idx)++)
|
||||
for ((_idx) = 0; (_idx) < memcg_nr_cache_ids; (_idx)++)
|
||||
|
||||
static inline bool memcg_kmem_enabled(void)
|
||||
{
|
||||
return static_key_false(&memcg_kmem_enabled_key);
|
||||
}
|
||||
|
||||
bool memcg_kmem_is_active(struct mem_cgroup *memcg);
|
||||
|
||||
/*
|
||||
* In general, we'll do everything in our power to not incur in any overhead
|
||||
* for non-memcg users for the kmem functions. Not even a function call, if we
|
||||
|
|
@ -432,11 +436,11 @@ void __memcg_kmem_uncharge_pages(struct page *page, int order);
|
|||
|
||||
int memcg_cache_id(struct mem_cgroup *memcg);
|
||||
|
||||
void memcg_update_array_size(int num_groups);
|
||||
|
||||
struct kmem_cache *__memcg_kmem_get_cache(struct kmem_cache *cachep);
|
||||
void __memcg_kmem_put_cache(struct kmem_cache *cachep);
|
||||
|
||||
struct mem_cgroup *__mem_cgroup_from_kmem(void *ptr);
|
||||
|
||||
int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp,
|
||||
unsigned long nr_pages);
|
||||
void memcg_uncharge_kmem(struct mem_cgroup *memcg, unsigned long nr_pages);
|
||||
|
|
@ -533,6 +537,13 @@ static __always_inline void memcg_kmem_put_cache(struct kmem_cache *cachep)
|
|||
if (memcg_kmem_enabled())
|
||||
__memcg_kmem_put_cache(cachep);
|
||||
}
|
||||
|
||||
static __always_inline struct mem_cgroup *mem_cgroup_from_kmem(void *ptr)
|
||||
{
|
||||
if (!memcg_kmem_enabled())
|
||||
return NULL;
|
||||
return __mem_cgroup_from_kmem(ptr);
|
||||
}
|
||||
#else
|
||||
#define for_each_memcg_cache_index(_idx) \
|
||||
for (; NULL; )
|
||||
|
|
@ -542,6 +553,11 @@ static inline bool memcg_kmem_enabled(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline bool memcg_kmem_is_active(struct mem_cgroup *memcg)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
|
||||
{
|
||||
|
|
@ -562,6 +578,14 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static inline void memcg_get_cache_ids(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void memcg_put_cache_ids(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct kmem_cache *
|
||||
memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
|
||||
{
|
||||
|
|
@ -571,6 +595,11 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
|
|||
static inline void memcg_kmem_put_cache(struct kmem_cache *cachep)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct mem_cgroup *mem_cgroup_from_kmem(void *ptr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_MEMCG_KMEM */
|
||||
#endif /* _LINUX_MEMCONTROL_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
|
|||
|
||||
#ifdef CONFIG_NUMA_BALANCING
|
||||
extern bool pmd_trans_migrating(pmd_t pmd);
|
||||
extern void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd);
|
||||
extern int migrate_misplaced_page(struct page *page,
|
||||
struct vm_area_struct *vma, int node);
|
||||
extern bool migrate_ratelimited(int node);
|
||||
|
|
@ -76,9 +75,6 @@ static inline bool pmd_trans_migrating(pmd_t pmd)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
static inline void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd)
|
||||
{
|
||||
}
|
||||
static inline int migrate_misplaced_page(struct page *page,
|
||||
struct vm_area_struct *vma, int node)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1408,6 +1408,11 @@ static inline void update_hiwater_vm(struct mm_struct *mm)
|
|||
mm->hiwater_vm = mm->total_vm;
|
||||
}
|
||||
|
||||
static inline void reset_mm_hiwater_rss(struct mm_struct *mm)
|
||||
{
|
||||
mm->hiwater_rss = get_mm_rss(mm);
|
||||
}
|
||||
|
||||
static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
|
||||
struct mm_struct *mm)
|
||||
{
|
||||
|
|
@ -1447,13 +1452,15 @@ static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
|
|||
int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
|
||||
#endif
|
||||
|
||||
#ifdef __PAGETABLE_PMD_FOLDED
|
||||
#if defined(__PAGETABLE_PMD_FOLDED) || !defined(CONFIG_MMU)
|
||||
static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
|
||||
unsigned long address)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void mm_nr_pmds_init(struct mm_struct *mm) {}
|
||||
|
||||
static inline unsigned long mm_nr_pmds(struct mm_struct *mm)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -1465,6 +1472,11 @@ static inline void mm_dec_nr_pmds(struct mm_struct *mm) {}
|
|||
#else
|
||||
int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
|
||||
|
||||
static inline void mm_nr_pmds_init(struct mm_struct *mm)
|
||||
{
|
||||
atomic_long_set(&mm->nr_pmds, 0);
|
||||
}
|
||||
|
||||
static inline unsigned long mm_nr_pmds(struct mm_struct *mm)
|
||||
{
|
||||
return atomic_long_read(&mm->nr_pmds);
|
||||
|
|
@ -2168,9 +2180,8 @@ int drop_caches_sysctl_handler(struct ctl_table *, int,
|
|||
void __user *, size_t *, loff_t *);
|
||||
#endif
|
||||
|
||||
unsigned long shrink_node_slabs(gfp_t gfp_mask, int nid,
|
||||
unsigned long nr_scanned,
|
||||
unsigned long nr_eligible);
|
||||
void drop_slab(void);
|
||||
void drop_slab_node(int nid);
|
||||
|
||||
#ifndef CONFIG_MMU
|
||||
#define randomize_va_space 0
|
||||
|
|
|
|||
|
|
@ -120,13 +120,13 @@ static inline void __node_clear(int node, volatile nodemask_t *dstp)
|
|||
}
|
||||
|
||||
#define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES)
|
||||
static inline void __nodes_setall(nodemask_t *dstp, int nbits)
|
||||
static inline void __nodes_setall(nodemask_t *dstp, unsigned int nbits)
|
||||
{
|
||||
bitmap_fill(dstp->bits, nbits);
|
||||
}
|
||||
|
||||
#define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES)
|
||||
static inline void __nodes_clear(nodemask_t *dstp, int nbits)
|
||||
static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits)
|
||||
{
|
||||
bitmap_zero(dstp->bits, nbits);
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ static inline int __node_test_and_set(int node, nodemask_t *addr)
|
|||
#define nodes_and(dst, src1, src2) \
|
||||
__nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES)
|
||||
static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p,
|
|||
#define nodes_or(dst, src1, src2) \
|
||||
__nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES)
|
||||
static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p,
|
|||
#define nodes_xor(dst, src1, src2) \
|
||||
__nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES)
|
||||
static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p,
|
|||
#define nodes_andnot(dst, src1, src2) \
|
||||
__nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES)
|
||||
static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p,
|
|||
#define nodes_complement(dst, src) \
|
||||
__nodes_complement(&(dst), &(src), MAX_NUMNODES)
|
||||
static inline void __nodes_complement(nodemask_t *dstp,
|
||||
const nodemask_t *srcp, int nbits)
|
||||
const nodemask_t *srcp, unsigned int nbits)
|
||||
{
|
||||
bitmap_complement(dstp->bits, srcp->bits, nbits);
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ static inline void __nodes_complement(nodemask_t *dstp,
|
|||
#define nodes_equal(src1, src2) \
|
||||
__nodes_equal(&(src1), &(src2), MAX_NUMNODES)
|
||||
static inline int __nodes_equal(const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_equal(src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ static inline int __nodes_equal(const nodemask_t *src1p,
|
|||
#define nodes_intersects(src1, src2) \
|
||||
__nodes_intersects(&(src1), &(src2), MAX_NUMNODES)
|
||||
static inline int __nodes_intersects(const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_intersects(src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
|
@ -200,25 +200,25 @@ static inline int __nodes_intersects(const nodemask_t *src1p,
|
|||
#define nodes_subset(src1, src2) \
|
||||
__nodes_subset(&(src1), &(src2), MAX_NUMNODES)
|
||||
static inline int __nodes_subset(const nodemask_t *src1p,
|
||||
const nodemask_t *src2p, int nbits)
|
||||
const nodemask_t *src2p, unsigned int nbits)
|
||||
{
|
||||
return bitmap_subset(src1p->bits, src2p->bits, nbits);
|
||||
}
|
||||
|
||||
#define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES)
|
||||
static inline int __nodes_empty(const nodemask_t *srcp, int nbits)
|
||||
static inline int __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
|
||||
{
|
||||
return bitmap_empty(srcp->bits, nbits);
|
||||
}
|
||||
|
||||
#define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES)
|
||||
static inline int __nodes_full(const nodemask_t *srcp, int nbits)
|
||||
static inline int __nodes_full(const nodemask_t *srcp, unsigned int nbits)
|
||||
{
|
||||
return bitmap_full(srcp->bits, nbits);
|
||||
}
|
||||
|
||||
#define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES)
|
||||
static inline int __nodes_weight(const nodemask_t *srcp, int nbits)
|
||||
static inline int __nodes_weight(const nodemask_t *srcp, unsigned int nbits)
|
||||
{
|
||||
return bitmap_weight(srcp->bits, nbits);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -417,9 +417,9 @@ enum {
|
|||
DUMP_PREFIX_ADDRESS,
|
||||
DUMP_PREFIX_OFFSET
|
||||
};
|
||||
extern void hex_dump_to_buffer(const void *buf, size_t len,
|
||||
int rowsize, int groupsize,
|
||||
char *linebuf, size_t linebuflen, bool ascii);
|
||||
extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
|
||||
int groupsize, char *linebuf, size_t linebuflen,
|
||||
bool ascii);
|
||||
#ifdef CONFIG_PRINTK
|
||||
extern void print_hex_dump(const char *level, const char *prefix_str,
|
||||
int prefix_type, int rowsize, int groupsize,
|
||||
|
|
|
|||
|
|
@ -1370,6 +1370,8 @@ struct task_struct {
|
|||
|
||||
unsigned long atomic_flags; /* Flags needing atomic access. */
|
||||
|
||||
struct restart_block restart_block;
|
||||
|
||||
pid_t pid;
|
||||
pid_t tgid;
|
||||
|
||||
|
|
@ -2145,6 +2147,7 @@ extern unsigned long long notrace sched_clock(void);
|
|||
*/
|
||||
extern u64 cpu_clock(int cpu);
|
||||
extern u64 local_clock(void);
|
||||
extern u64 running_clock(void);
|
||||
extern u64 sched_clock_cpu(int cpu);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ struct shrink_control {
|
|||
|
||||
/* current node being shrunk (for NUMA aware shrinkers) */
|
||||
int nid;
|
||||
|
||||
/* current memcg being shrunk (for memcg aware shrinkers) */
|
||||
struct mem_cgroup *memcg;
|
||||
};
|
||||
|
||||
#define SHRINK_STOP (~0UL)
|
||||
|
|
@ -61,7 +64,8 @@ struct shrinker {
|
|||
#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
|
||||
|
||||
/* Flags */
|
||||
#define SHRINKER_NUMA_AWARE (1 << 0)
|
||||
#define SHRINKER_NUMA_AWARE (1 << 0)
|
||||
#define SHRINKER_MEMCG_AWARE (1 << 1)
|
||||
|
||||
extern int register_shrinker(struct shrinker *);
|
||||
extern void unregister_shrinker(struct shrinker *);
|
||||
|
|
|
|||
|
|
@ -115,13 +115,12 @@ int slab_is_available(void);
|
|||
struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
|
||||
unsigned long,
|
||||
void (*)(void *));
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
void memcg_create_kmem_cache(struct mem_cgroup *, struct kmem_cache *);
|
||||
void memcg_destroy_kmem_caches(struct mem_cgroup *);
|
||||
#endif
|
||||
void kmem_cache_destroy(struct kmem_cache *);
|
||||
int kmem_cache_shrink(struct kmem_cache *);
|
||||
void kmem_cache_free(struct kmem_cache *, void *);
|
||||
|
||||
void memcg_create_kmem_cache(struct mem_cgroup *, struct kmem_cache *);
|
||||
void memcg_deactivate_kmem_caches(struct mem_cgroup *);
|
||||
void memcg_destroy_kmem_caches(struct mem_cgroup *);
|
||||
|
||||
/*
|
||||
* Please use this macro to create slab caches. Simply specify the
|
||||
|
|
@ -288,6 +287,7 @@ static __always_inline int kmalloc_index(size_t size)
|
|||
|
||||
void *__kmalloc(size_t size, gfp_t flags);
|
||||
void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags);
|
||||
void kmem_cache_free(struct kmem_cache *, void *);
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
void *__kmalloc_node(size_t size, gfp_t flags, int node);
|
||||
|
|
@ -473,14 +473,14 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
|
|||
#ifndef ARCH_SLAB_MINALIGN
|
||||
#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
|
||||
#endif
|
||||
|
||||
struct memcg_cache_array {
|
||||
struct rcu_head rcu;
|
||||
struct kmem_cache *entries[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the main placeholder for memcg-related information in kmem caches.
|
||||
* struct kmem_cache will hold a pointer to it, so the memory cost while
|
||||
* disabled is 1 pointer. The runtime cost while enabled, gets bigger than it
|
||||
* would otherwise be if that would be bundled in kmem_cache: we'll need an
|
||||
* extra pointer chase. But the trade off clearly lays in favor of not
|
||||
* penalizing non-users.
|
||||
*
|
||||
* Both the root cache and the child caches will have it. For the root cache,
|
||||
* this will hold a dynamically allocated array large enough to hold
|
||||
* information about the currently limited memcgs in the system. To allow the
|
||||
|
|
@ -491,14 +491,15 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
|
|||
*
|
||||
* @memcg: pointer to the memcg this cache belongs to
|
||||
* @root_cache: pointer to the global, root cache, this cache was derived from
|
||||
*
|
||||
* Both root and child caches of the same kind are linked into a list chained
|
||||
* through @list.
|
||||
*/
|
||||
struct memcg_cache_params {
|
||||
bool is_root_cache;
|
||||
struct list_head list;
|
||||
union {
|
||||
struct {
|
||||
struct rcu_head rcu_head;
|
||||
struct kmem_cache *memcg_caches[0];
|
||||
};
|
||||
struct memcg_cache_array __rcu *memcg_caches;
|
||||
struct {
|
||||
struct mem_cgroup *memcg;
|
||||
struct kmem_cache *root_cache;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ struct kmem_cache {
|
|||
int obj_offset;
|
||||
#endif /* CONFIG_DEBUG_SLAB */
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
struct memcg_cache_params *memcg_params;
|
||||
struct memcg_cache_params memcg_params;
|
||||
#endif
|
||||
|
||||
struct kmem_cache_node *node[MAX_NUMNODES];
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ struct kmem_cache {
|
|||
struct kobject kobj; /* For sysfs */
|
||||
#endif
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
struct memcg_cache_params *memcg_params;
|
||||
struct memcg_cache_params memcg_params;
|
||||
int max_attr_size; /* for propagation, maximum size of a stored attr */
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct kset *memcg_kset;
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ extern int strcmp(const char *,const char *);
|
|||
#ifndef __HAVE_ARCH_STRNCMP
|
||||
extern int strncmp(const char *,const char *,__kernel_size_t);
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_STRNICMP
|
||||
#define strnicmp strncasecmp
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_STRCASECMP
|
||||
extern int strcasecmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ enum string_size_units {
|
|||
STRING_UNITS_2, /* use binary powers of 2^10 */
|
||||
};
|
||||
|
||||
int string_get_size(u64 size, enum string_size_units units,
|
||||
char *buf, int len);
|
||||
void string_get_size(u64 size, enum string_size_units units,
|
||||
char *buf, int len);
|
||||
|
||||
#define UNESCAPE_SPACE 0x01
|
||||
#define UNESCAPE_OCTAL 0x02
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
|
|||
/* check whether a pte points to a swap entry */
|
||||
static inline int is_swap_pte(pte_t pte)
|
||||
{
|
||||
return !pte_none(pte) && !pte_present_nonuma(pte);
|
||||
return !pte_none(pte) && !pte_present(pte);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -135,12 +135,9 @@ typedef unsigned long blkcnt_t;
|
|||
#endif
|
||||
|
||||
/*
|
||||
* The type of an index into the pagecache. Use a #define so asm/types.h
|
||||
* can override it.
|
||||
* The type of an index into the pagecache.
|
||||
*/
|
||||
#ifndef pgoff_t
|
||||
#define pgoff_t unsigned long
|
||||
#endif
|
||||
|
||||
/* A dma_addr_t can hold any valid DMA or bus address for the platform */
|
||||
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ enum zpool_mapmode {
|
|||
ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
|
||||
};
|
||||
|
||||
struct zpool *zpool_create_pool(char *type, gfp_t gfp, struct zpool_ops *ops);
|
||||
struct zpool *zpool_create_pool(char *type, char *name,
|
||||
gfp_t gfp, struct zpool_ops *ops);
|
||||
|
||||
char *zpool_get_type(struct zpool *pool);
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ struct zpool_driver {
|
|||
atomic_t refcount;
|
||||
struct list_head list;
|
||||
|
||||
void *(*create)(gfp_t gfp, struct zpool_ops *ops);
|
||||
void *(*create)(char *name, gfp_t gfp, struct zpool_ops *ops);
|
||||
void (*destroy)(void *pool);
|
||||
|
||||
int (*malloc)(void *pool, size_t size, gfp_t gfp,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ enum zs_mapmode {
|
|||
|
||||
struct zs_pool;
|
||||
|
||||
struct zs_pool *zs_create_pool(gfp_t flags);
|
||||
struct zs_pool *zs_create_pool(char *name, gfp_t flags);
|
||||
void zs_destroy_pool(struct zs_pool *pool);
|
||||
|
||||
unsigned long zs_malloc(struct zs_pool *pool, size_t size);
|
||||
|
|
|
|||
Loading…
Reference in a new issue