From: Cong Wang <xiyou.wangcong@gmail.com>
To: Linux Kernel Network Developers <netdev@vger.kernel.org>
Cc: bpf <bpf@vger.kernel.org>, Cong Wang <cong.wang@bytedance.com>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Dongdong Wang <wangdongdong.6@bytedance.com>
Subject: Re: [Patch bpf-next v4 1/3] bpf: introduce timeout hash map
Date: Mon, 18 Jan 2021 11:10:09 -0800 [thread overview]
Message-ID: <CAM_iQpXha9ZGyszHUR3qs21p+awGtrioEmxba7XOYkpm8dsXGw@mail.gmail.com> (raw)
In-Reply-To: <20210117042224.17839-2-xiyou.wangcong@gmail.com>
On Sat, Jan 16, 2021 at 8:22 PM Cong Wang <xiyou.wangcong@gmail.com> wrote:
> +static void htab_gc(struct work_struct *work)
> +{
> + struct htab_elem *e, *tmp;
> + struct llist_node *lhead;
> + struct bpf_htab *htab;
> + int i, count;
> +
> + htab = container_of(work, struct bpf_htab, gc_work.work);
> + lhead = llist_del_all(&htab->gc_list);
> +
> + llist_for_each_entry_safe(e, tmp, lhead, gc_node) {
> + unsigned long flags;
> + struct bucket *b;
> + u32 hash;
> +
> + hash = e->hash;
> + b = __select_bucket(htab, hash);
> + if (htab_lock_bucket(htab, b, hash, &flags))
> + continue;
> + hlist_nulls_del_rcu(&e->hash_node);
> + atomic_set(&e->pending, 0);
> + free_htab_elem(htab, e);
> + htab_unlock_bucket(htab, b, hash, flags);
> +
> + cond_resched();
> + }
> +
> + for (count = 0, i = 0; i < htab->n_buckets; i++) {
I just realized a followup fix is not folded into this patch, I
actually added a timestamp check here to avoid scanning the whole
table more frequently than once per second. It is clearly my mistake
to miss it when formatting this patchset.
I will send v5 after waiting for other feedback.
Thanks!
next prev parent reply other threads:[~2021-01-18 19:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-17 4:22 [Patch bpf-next v4 0/3] bpf: introduce timeout hash map Cong Wang
2021-01-17 4:22 ` [Patch bpf-next v4 1/3] " Cong Wang
2021-01-18 19:10 ` Cong Wang [this message]
2021-01-17 4:22 ` [Patch bpf-next v4 2/3] selftests/bpf: add test cases for bpf timeout map Cong Wang
2021-01-17 4:22 ` [Patch bpf-next v4 3/3] selftests/bpf: add timeout map check in map_ptr tests Cong Wang
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=CAM_iQpXha9ZGyszHUR3qs21p+awGtrioEmxba7XOYkpm8dsXGw@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cong.wang@bytedance.com \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=wangdongdong.6@bytedance.com \
/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;
as well as URLs for NNTP newsgroup(s).