Lu Jialin (2): memcg/kabi: reserve space for memcg related structures cgroup_bpf/kabi: reserve space for cgroup_bpf releated structure
include/linux/bpf-cgroup-defs.h | 28 ++++++++++++++++++++++++++++ include/linux/bpf.h | 11 +++++++++++ include/linux/memcontrol.h | 28 ++++++++++++++++++++++++++++ mm/memcontrol.c | 7 +++++++ 4 files changed, 74 insertions(+)
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8TP4Z
--------------------------------
We reserve some fields beforehand for memcg related structures prone to change, therefore, we can hot add/change features of memcg with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
Signed-off-by: Lu Jialin lujialin4@huawei.com --- include/linux/memcontrol.h | 28 ++++++++++++++++++++++++++++ mm/memcontrol.c | 7 +++++++ 2 files changed, 35 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 31aff8b9286a..0ece2c040529 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -21,6 +21,7 @@ #include <linux/vmstat.h> #include <linux/writeback.h> #include <linux/page-flags.h> +#include <linux/kabi.h>
struct mem_cgroup; struct obj_cgroup; @@ -51,6 +52,12 @@ enum memcg_memory_event { MEMCG_SWAP_HIGH, MEMCG_SWAP_MAX, MEMCG_SWAP_FAIL, +#ifdef CONFIG_KABI_RESERVE + MEMCG_MEMORY_EVENTS_RESERVE_1, + MEMCG_MEMORY_EVENTS_RESERVE_2, + MEMCG_MEMORY_EVENTS_RESERVE_3, + MEMCG_MEMORY_EVENTS_RESERVE_4, +#endif MEMCG_NR_MEMORY_EVENTS, };
@@ -66,6 +73,7 @@ struct mem_cgroup_reclaim_cookie { struct mem_cgroup_id { int id; refcount_t ref; + KABI_RESERVE(1) };
/* @@ -106,6 +114,9 @@ struct lruvec_stats_percpu {
/* Delta calculation for lockless upward propagation */ long state_prev[NR_VM_NODE_STAT_ITEMS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct lruvec_stats { @@ -117,6 +128,9 @@ struct lruvec_stats {
/* Pending child counts during tree propagation */ long state_pending[NR_VM_NODE_STAT_ITEMS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* @@ -140,6 +154,9 @@ struct mem_cgroup_per_node { bool on_tree; struct mem_cgroup *memcg; /* Back pointer, we cannot */ /* use container_of */ + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct mem_cgroup_threshold { @@ -166,6 +183,9 @@ struct mem_cgroup_thresholds { * It must be able to store at least primary->size - 1 entries. */ struct mem_cgroup_threshold_ary *spare; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* @@ -350,6 +370,14 @@ struct mem_cgroup { bool high_async_reclaim; #endif
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) struct mem_cgroup_per_node *nodeinfo[]; };
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2e80504a49c0..c2bb6254ed1a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -75,6 +75,7 @@
#include <trace/events/vmscan.h> #include <linux/ksm.h> +#include <linux/kabi.h>
struct cgroup_subsys memory_cgrp_subsys __read_mostly; EXPORT_SYMBOL(memory_cgrp_subsys); @@ -755,6 +756,9 @@ struct memcg_vmstats_percpu { /* Cgroup1: threshold notifications & softlimit tree updates */ unsigned long nr_page_events; unsigned long targets[MEM_CGROUP_NTARGETS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct memcg_vmstats { @@ -769,6 +773,9 @@ struct memcg_vmstats { /* Pending child counts during tree propagation */ long state_pending[MEMCG_NR_STAT]; unsigned long events_pending[NR_MEMCG_EVENTS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx)
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8TP4Z
--------------------------------
We reserve some fields beforehand for cgroup_bpf_attach_type bpf_cgroup_storage_type prone and struct cgroup_bpf to change, therefore, we can hot add/change features of bpf cgroup with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
Signed-off-by: Lu Jialin lujialin4@huawei.com --- include/linux/bpf-cgroup-defs.h | 28 ++++++++++++++++++++++++++++ include/linux/bpf.h | 11 +++++++++++ 2 files changed, 39 insertions(+)
diff --git a/include/linux/bpf-cgroup-defs.h b/include/linux/bpf-cgroup-defs.h index 7b121bd780eb..98e0596b40e8 100644 --- a/include/linux/bpf-cgroup-defs.h +++ b/include/linux/bpf-cgroup-defs.h @@ -7,6 +7,7 @@ #include <linux/list.h> #include <linux/percpu-refcount.h> #include <linux/workqueue.h> +#include <linux/kabi.h>
struct bpf_prog_array;
@@ -44,6 +45,16 @@ enum cgroup_bpf_attach_type { CGROUP_INET_SOCK_RELEASE, CGROUP_LSM_START, CGROUP_LSM_END = CGROUP_LSM_START + CGROUP_LSM_NUM - 1, +#ifdef CONFIG_KABI_RESERVE + CGROUP_ATTACH_TYPE_KABI_RESERVE_1, + CGROUP_ATTACH_TYPE_KABI_RESERVE_2, + CGROUP_ATTACH_TYPE_KABI_RESERVE_3, + CGROUP_ATTACH_TYPE_KABI_RESERVE_4, + CGROUP_ATTACH_TYPE_KABI_RESERVE_5, + CGROUP_ATTACH_TYPE_KABI_RESERVE_6, + CGROUP_ATTACH_TYPE_KABI_RESERVE_7, + CGROUP_ATTACH_TYPE_KABI_RESERVE_8, +#endif MAX_CGROUP_BPF_ATTACH_TYPE };
@@ -70,6 +81,23 @@ struct cgroup_bpf {
/* cgroup_bpf is released using a work queue */ struct work_struct release_work; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) + KABI_RESERVE(16) };
#else /* CONFIG_CGROUP_BPF */ diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 392f581af2ce..5ac22a961534 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -29,6 +29,7 @@ #include <linux/rcupdate_trace.h> #include <linux/static_call.h> #include <linux/memcontrol.h> +#include <linux/kabi.h>
struct bpf_verifier_env; struct bpf_verifier_log; @@ -974,6 +975,16 @@ struct bpf_prog_offload { enum bpf_cgroup_storage_type { BPF_CGROUP_STORAGE_SHARED, BPF_CGROUP_STORAGE_PERCPU, +#ifdef CONFIG_KABI_RESERVE + BPF_CGROUP_STORAGE_KABI_RESERVE_1, + BPF_CGROUP_STORAGE_KABI_RESERVE_2, + BPF_CGROUP_STORAGE_KABI_RESERVE_3, + BPF_CGROUP_STORAGE_KABI_RESERVE_4, + BPF_CGROUP_STORAGE_KABI_RESERVE_5, + BPF_CGROUP_STORAGE_KABI_RESERVE_6, + BPF_CGROUP_STORAGE_KABI_RESERVE_7, + BPF_CGROUP_STORAGE_KABI_RESERVE_8, +#endif __BPF_CGROUP_STORAGE_MAX };
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3789 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/5...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3789 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/5...