mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
mm: Omit RCU read lock in list_lru_count_one() when RCU isn't needed
The RCU read lock isn't necessary in list_lru_count_one() when the condition that requires RCU (CONFIG_MEMCG && !CONFIG_SLOB) isn't met. The highly-frequent RCU lock and unlock adds measurable overhead to the shrink_slab() path when it isn't needed. As such, we can simply omit the RCU read lock in this case to improve performance. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Signed-off-by: Forenche <prahul2003@gmail.com>
This commit is contained in:
parent
6ed4cfa7e6
commit
77fc3a0716
@ -161,6 +161,7 @@ EXPORT_SYMBOL_GPL(list_lru_isolate_move);
|
|||||||
unsigned long list_lru_count_one(struct list_lru *lru,
|
unsigned long list_lru_count_one(struct list_lru *lru,
|
||||||
int nid, struct mem_cgroup *memcg)
|
int nid, struct mem_cgroup *memcg)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
|
||||||
struct list_lru_node *nlru = &lru->node[nid];
|
struct list_lru_node *nlru = &lru->node[nid];
|
||||||
struct list_lru_one *l;
|
struct list_lru_one *l;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
@ -171,6 +172,9 @@ unsigned long list_lru_count_one(struct list_lru *lru,
|
|||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
#else
|
||||||
|
return READ_ONCE(lru->node[nid].lru.nr_items);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(list_lru_count_one);
|
EXPORT_SYMBOL_GPL(list_lru_count_one);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user