From: Vasily Averin <vasily.averin@linux.dev>
To: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
kernel@openvz.org, Jozsef Kadlecsik <kadlec@netfilter.org>,
netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Roman Gushchin <roman.gushchin@linux.dev>
Subject: Re: [PATCH nft] nft: memcg accounting for dynamically allocated objects
Date: Sat, 2 Apr 2022 11:55:49 +0300 [thread overview]
Message-ID: <935e4270-9e0e-4cd0-ffb4-9c1eb3d9c56e@linux.dev> (raw)
In-Reply-To: <20220401193159.GB28321@breakpoint.cc>
On 4/1/22 22:31, Florian Westphal wrote:
> Vasily Averin <vasily.averin@linux.dev> wrote:
>>> Same problem as connlimit, can be called from packet path.
>>> Basically all GFP_ATOMIC are suspicious.
>>>
>>> Not sure how to resolve this, similar mechanics in iptables world (e.g.
>>> connlimit or SET target) don't use memcg accounting.
>>>
>>> Perhaps for now resend with only the GFP_KERNEL parts converted?
>>> Those are safe.
>>
>> It is safe for packet path too, _ACCOUNT allocation will not be able to find memcg
>> in case of "!in_task()" context.
>> On the other hand any additional checks on such path will affect performance.
>
> I'm not sure this works with ksoftirqd serving network stack?
Please take look at memcg_kmem_bypass() called from
memcg_slab_pre_alloc_hook -> get_obj_cgroup_from_current
By default memcg accounting does not work for any kernel threads.
If required thread can use set_active_memcg() but at present it is not widely used.
>> Could you please estimate how often is this code used in the case of nft vs packet path?
>
> It depends on user configuration.
> Update from packet path is used for things like port knocking or other
> dyanamic filter lists, or somehing like Limiting connections to x-per-address/subnet and so on.
Ok, I think we can skip accounting in such cases at the moment.
I doubt it can be misused and consume significant piece of host memory.
So I'm going to resend the patch w/o accounting in all .clone callbacks.
>> If the opposite is the case, then I can add __GFP_ACCOUNT flag depending on in_task() check.
>
> But what task/memcg is used for the accounting in that case?
Thanks to Roman for the explanation in concurrent thread.
Thank you,
Vasily Averin
next prev parent reply other threads:[~2022-04-02 8:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220228122429.GC26547@breakpoint.cc>
2022-03-21 5:02 ` [PATCH v2] memcg: enable accounting for nft objects Vasily Averin
2022-03-22 10:25 ` Florian Westphal
2022-03-24 14:19 ` Pablo Neira Ayuso
2022-03-24 17:23 ` Vasily Averin
2022-03-24 18:05 ` [PATCH v2 RESEND] " Vasily Averin
2022-03-28 8:15 ` Pablo Neira Ayuso
2022-03-28 9:23 ` Vasily Averin
2022-03-31 8:40 ` [PATCH nft] nft: memcg accounting for dynamically allocated objects Vasily Averin
2022-03-31 18:45 ` Roman Gushchin
2022-04-01 12:03 ` Florian Westphal
2022-04-01 18:56 ` Vasily Averin
2022-04-01 19:31 ` Florian Westphal
2022-04-01 21:14 ` Roman Gushchin
2022-04-01 23:01 ` Florian Westphal
2022-04-02 8:55 ` Vasily Averin [this message]
2022-04-02 9:50 ` [PATCH v2] " Vasily Averin
2022-04-05 9:58 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=935e4270-9e0e-4cd0-ffb4-9c1eb3d9c56e@linux.dev \
--to=vasily.averin@linux.dev \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kernel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=roman.gushchin@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome