提交 abccd5fa 编写于 作者: T Tang Yizhou 提交者: Yang Yingliang

share_pool: Introduce struct sp_spg_stat

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI
CVE: NA

-------------------------------------------------

In multi-group mode, we introduce struct sp_spg_stat which represents
statistics for an sp_group. It is the accumulation of all structs of
spg_proc_stat in an sp_group.
Signed-off-by: NTang Yizhou <tangyizhou@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 929b5418
...@@ -53,6 +53,27 @@ extern unsigned long sysctl_sp_compact_interval_max; ...@@ -53,6 +53,27 @@ extern unsigned long sysctl_sp_compact_interval_max;
extern bool vmap_allow_huge; extern bool vmap_allow_huge;
#endif #endif
/* we estimate an sp-group ususally contains at most 64 sp-group */
#define SP_SPG_HASH_BITS 6
struct sp_spg_stat {
int spg_id;
/* number of sp_area */
atomic_t spa_num;
/* total size of all sp_area from sp_alloc and k2u */
atomic64_t size;
/* total size of all sp_area from sp_alloc 0-order page */
atomic64_t alloc_nsize;
/* total size of all sp_area from sp_alloc hugepage */
atomic64_t alloc_hsize;
/* total size of all sp_area from ap_alloc */
atomic64_t alloc_size;
/* total size of all sp_area from sp_k2u */
atomic64_t k2u_size;
struct mutex lock; /* protect hashtable */
DECLARE_HASHTABLE(hash, SP_SPG_HASH_BITS);
};
/* Processes in the same sp_group can share memory. /* Processes in the same sp_group can share memory.
* Memory layout for share pool: * Memory layout for share pool:
* *
...@@ -87,16 +108,8 @@ struct sp_group { ...@@ -87,16 +108,8 @@ struct sp_group {
struct list_head procs; struct list_head procs;
/* list head of sp_area. it is protected by spin_lock sp_area_lock */ /* list head of sp_area. it is protected by spin_lock sp_area_lock */
struct list_head spa_list; struct list_head spa_list;
/* number of sp_area */ /* group statistics */
atomic_t spa_num; struct sp_spg_stat *stat;
/* total size of all sp_area from sp_alloc and k2u(spg) */
atomic64_t size;
/* total size of all sp_area from sp_alloc normal page */
atomic64_t alloc_nsize;
/* total size of all sp_area from sp_alloc hugepage */
atomic64_t alloc_hsize;
/* total size of all sp_area from ap_alloc */
atomic64_t alloc_size;
/* we define the creator process of a sp_group as owner */ /* we define the creator process of a sp_group as owner */
struct task_struct *owner; struct task_struct *owner;
/* is_alive == false means it's being destroyed */ /* is_alive == false means it's being destroyed */
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册