[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vbfsgpu4bfg.fsf@mellanox.com>
Date: Wed, 21 Aug 2019 18:32:07 +0000
From: Vlad Buslov <vladbu@...lanox.com>
To: Matthew Wilcox <willy@...radead.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 30/38] cls_flower: Use XArray list of filters in fl_walk
On Wed 21 Aug 2019 at 01:32, Matthew Wilcox <willy@...radead.org> wrote:
> From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
>
> Instead of iterating over every filter attached to every mark, just
> iterate over each filter.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
> net/sched/cls_flower.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index 54026c9e9b05..2a1999d2b507 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c
> @@ -575,18 +575,15 @@ static void fl_destroy(struct tcf_proto *tp, bool rtnl_held,
> struct netlink_ext_ack *extack)
> {
> struct cls_fl_head *head = fl_head_dereference(tp);
> - struct fl_flow_mask *mask, *next_mask;
> - struct cls_fl_filter *f, *next;
> + struct cls_fl_filter *f;
> + unsigned long handle;
> bool last;
>
> - list_for_each_entry_safe(mask, next_mask, &head->masks, list) {
> - list_for_each_entry_safe(f, next, &mask->filters, list) {
> - __fl_delete(tp, f, &last, rtnl_held, extack);
> - if (last)
> - break;
> - }
> + xa_for_each(&head->filters, handle, f) {
> + __fl_delete(tp, f, &last, rtnl_held, extack);
> + if (last)
> + break;
> }
> - xa_destroy(&head->filters);
>
> __module_get(THIS_MODULE);
> tcf_queue_work(&head->rwork, fl_destroy_sleepable);
What is the motivation for this change? You substitute O(n) iteration
over linked list with O(nlogn) iteration over xarray without any
apparent benefit.
Powered by blists - more mailing lists