[Devel] [PATCH] venet: remove obsolete tgt_veip variable
This was used for "vzredir" feature in vz6 and not used anymore. Signed-off-by: Stanislav Kinsburskiy--- drivers/net/venetdev.c | 12 +++- include/linux/venet.h |1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c index 11f4a66..dffebdc 100644 --- a/drivers/net/venetdev.c +++ b/drivers/net/venetdev.c @@ -256,8 +256,7 @@ static void __veip_stop(struct ve_struct *ve) ptr = list_entry(p, struct ip_entry_struct, ve_list); ptr->active_env = NULL; - if (ptr->tgt_veip == NULL) - ip_entry_unhash(ptr); + ip_entry_unhash(ptr); } veip_pool_ops->veip_release(ve); @@ -277,8 +276,6 @@ static int veip_entry_conflict(struct ip_entry_struct *entry, struct ve_struct * { if (entry->active_env != NULL) return -EADDRINUSE; - if (entry->tgt_veip && entry->tgt_veip->veid != ve->veid) - return -EADDRNOTAVAIL; entry->active_env = ve; return 0; @@ -340,8 +337,7 @@ static int veip_entry_del(struct ve_struct *ve, struct ve_addr_struct *addr) err = 0; found->active_env = NULL; - if (found->tgt_veip == NULL) - ip_entry_unhash(found); + ip_entry_unhash(found); out: spin_unlock(_lock); return err; @@ -891,7 +887,6 @@ static int veip_seq_show(struct seq_file *m, void *v) { struct hlist_node *p; struct ip_entry_struct *entry; - struct veip_struct *veip; char s[40]; if (v == SEQ_START_TOKEN) { @@ -902,8 +897,7 @@ static int veip_seq_show(struct seq_file *m, void *v) p = (struct hlist_node *)v; entry = hlist_entry(p, struct ip_entry_struct, ip_hash); veaddr_print(s, sizeof(s), >addr); - veip = ACCESS_ONCE(entry->tgt_veip); - seq_printf(m, "%39s %10u\n", s, veip == NULL ? 0 : veip->veid); + seq_printf(m, "%39s 0\n", s); return 0; } diff --git a/include/linux/venet.h b/include/linux/venet.h index 7562996..08d89bc 100644 --- a/include/linux/venet.h +++ b/include/linux/venet.h @@ -28,7 +28,6 @@ struct ip_entry_struct { struct ve_addr_struct addr; struct ve_struct*active_env; - struct veip_struct *tgt_veip; struct hlist_node ip_hash; union { struct list_headve_list; ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
Re: [Devel] [PATCH] venet: VEIP release debug patch
Sorry, ignore 27.11.2017 15:48, Stanislav Kinsburskiy пишет: > Needed to investigate VEIP release - CT stop race. > > https://jira.sw.ru/browse/PSBM-78078 > > Signed-off-by: Stanislav Kinsburskiy> --- > drivers/net/venetdev.c |6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c > index 11f4a66..dcdb51d 100644 > --- a/drivers/net/venetdev.c > +++ b/drivers/net/venetdev.c > @@ -256,8 +256,12 @@ static void __veip_stop(struct ve_struct *ve) > ptr = list_entry(p, struct ip_entry_struct, ve_list); > ptr->active_env = NULL; > > - if (ptr->tgt_veip == NULL) > + if (ptr->tgt_veip == NULL) { > + printk("%s: removing IP for ve %d\n", __func__, > + ptr->tgt_veip->veid); > + dump_stack(); > ip_entry_unhash(ptr); > + } > } > > veip_pool_ops->veip_release(ve); > > ___ > Devel mailing list > Devel@openvz.org > https://lists.openvz.org/mailman/listinfo/devel > ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH] venet: VEIP release debug patch
Needed to investigate VEIP release - CT stop race. https://jira.sw.ru/browse/PSBM-78078 Signed-off-by: Stanislav Kinsburskiy--- drivers/net/venetdev.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c index 11f4a66..dcdb51d 100644 --- a/drivers/net/venetdev.c +++ b/drivers/net/venetdev.c @@ -256,8 +256,12 @@ static void __veip_stop(struct ve_struct *ve) ptr = list_entry(p, struct ip_entry_struct, ve_list); ptr->active_env = NULL; - if (ptr->tgt_veip == NULL) + if (ptr->tgt_veip == NULL) { + printk("%s: removing IP for ve %d\n", __func__, + ptr->tgt_veip->veid); + dump_stack(); ip_entry_unhash(ptr); + } } veip_pool_ops->veip_release(ve); ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH rh7] mm/memcg: limit page cache in memcg hack.
Add new memcg file - memory.cache.limit_in_bytes. Used to limit page cache usage in cgroup. Signed-off-by: Andrey Ryabinin--- mm/memcontrol.c | 144 +--- 1 file changed, 126 insertions(+), 18 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a165a221e87b..116b303319af 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -314,6 +314,8 @@ struct mem_cgroup { */ struct page_counter dcache; + struct page_counter cache; + /* beancounter-related stats */ unsigned long long swap_max; atomic_long_t mem_failcnt; @@ -502,6 +504,7 @@ enum res_type { _MEMSWAP, _OOM_TYPE, _KMEM, + _CACHE, }; #define MEMFILE_PRIVATE(x, val)((x) << 16 | (val)) @@ -2771,7 +2774,7 @@ static int memcg_cpu_hotplug_callback(struct notifier_block *nb, * was bypassed to root_mem_cgroup, and -ENOMEM if the charge failed. */ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, bool kmem_charge, - unsigned int nr_pages) + unsigned int nr_pages, bool cache_charge) { unsigned int batch = max(CHARGE_BATCH, nr_pages); int nr_retries = MEM_CGROUP_RECLAIM_RETRIES; @@ -2786,12 +2789,22 @@ retry: flags = 0; if (consume_stock(memcg, nr_pages)) { - if (!kmem_charge) - goto done; - if (!page_counter_try_charge(>kmem, nr_pages, )) + if (kmem_charge && page_counter_try_charge( + >kmem, nr_pages, )) { + refill_stock(memcg, nr_pages); + goto charge; + } + + if (cache_charge && !page_counter_try_charge( + >cache, nr_pages, )) goto done; + + refill_stock(memcg, nr_pages); + if (kmem_charge) + page_counter_uncharge(>kmem, nr_pages); } +charge: mem_over_limit = NULL; if (!page_counter_try_charge(>memory, batch, )) { if (do_swap_account && page_counter_try_charge( @@ -2804,15 +2817,29 @@ retry: mem_over_limit = mem_cgroup_from_counter(counter, memory); if (!mem_over_limit && kmem_charge) { - if (!page_counter_try_charge(>kmem, nr_pages, )) + if (page_counter_try_charge(>kmem, nr_pages, )) { + flags |= MEM_CGROUP_RECLAIM_KMEM; + mem_over_limit = mem_cgroup_from_counter(counter, kmem); + page_counter_uncharge(>memory, batch); + if (do_swap_account) + page_counter_uncharge(>memsw, batch); + } + } + + if (!mem_over_limit && cache_charge) { + if (!page_counter_try_charge(>cache, nr_pages, )) goto done_restock; - flags |= MEM_CGROUP_RECLAIM_KMEM; - mem_over_limit = mem_cgroup_from_counter(counter, kmem); + flags |= MEM_CGROUP_RECLAIM_NOSWAP; + mem_over_limit = mem_cgroup_from_counter(counter, cache); page_counter_uncharge(>memory, batch); if (do_swap_account) page_counter_uncharge(>memsw, batch); - } else if (!mem_over_limit) + if (kmem_charge) + page_counter_uncharge(>kmem, batch); + } + + if (!mem_over_limit) goto done_restock; if (batch > nr_pages) { @@ -2898,12 +2925,15 @@ done: return 0; } -static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages) +static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages, + bool cache_charge) { if (!mem_cgroup_is_root(memcg)) { page_counter_uncharge(>memory, nr_pages); if (do_swap_account) page_counter_uncharge(>memsw, nr_pages); + if (cache_charge) + page_counter_uncharge(>cache, nr_pages); } } @@ -3068,7 +3098,7 @@ int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp, { int ret = 0; - ret = try_charge(memcg, gfp, true, nr_pages); + ret = try_charge(memcg, gfp, true, nr_pages, false); if (ret == -EINTR) { /* * try_charge() chose to bypass to root due to OOM kill or @@ -4327,6 +4357,9 @@ static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft, case _KMEM: counter = >kmem; break; + case _CACHE: + counter = >cache; + break; default: BUG(); } @@ -4479,6 +4512,57 @@ static int memcg_update_kmem_limit(struct mem_cgroup *memcg, } #endif /* CONFIG_MEMCG_KMEM */