All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-28  6:41 Chris Mi
  2017-08-28  6:41 ` [patch net-next 1/3] idr: Add new APIs to support unsigned long Chris Mi
                   ` (2 more replies)
  0 siblings, 3 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-28  6:41 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, mawilcox

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we add several new IDR APIs
to support unsigned long.

Chris Mi (3):
  idr: Add new APIs to support unsigned long
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 include/linux/idr.h        |  16 +++
 include/linux/radix-tree.h |   3 +
 include/net/act_api.h      |  76 +++++---------
 lib/idr.c                  |  56 ++++++++++
 lib/radix-tree.c           |  73 +++++++++++++
 net/sched/act_api.c        | 251 ++++++++++++++++++++++-----------------------
 net/sched/act_bpf.c        |  17 ++-
 net/sched/act_connmark.c   |  16 ++-
 net/sched/act_csum.c       |  16 ++-
 net/sched/act_gact.c       |  16 ++-
 net/sched/act_ife.c        |  20 ++--
 net/sched/act_ipt.c        |  26 +++--
 net/sched/act_mirred.c     |  19 ++--
 net/sched/act_nat.c        |  16 ++-
 net/sched/act_pedit.c      |  18 ++--
 net/sched/act_police.c     |  18 ++--
 net/sched/act_sample.c     |  17 ++-
 net/sched/act_simple.c     |  20 ++--
 net/sched/act_skbedit.c    |  18 ++--
 net/sched/act_skbmod.c     |  18 ++--
 net/sched/act_tunnel_key.c |  20 ++--
 net/sched/act_vlan.c       |  22 ++--
 net/sched/cls_flower.c     |  55 +++++-----
 23 files changed, 450 insertions(+), 377 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 1/3] idr: Add new APIs to support unsigned long
  2017-08-28  6:41 [patch net-next 0/3] net/sched: Improve getting objects by indexes Chris Mi
@ 2017-08-28  6:41 ` Chris Mi
  2017-08-29  7:14   ` Hannes Frederic Sowa
  2017-08-28  6:41 ` [patch net-next 2/3] net/sched: Change cls_flower to use IDR Chris Mi
  2017-08-28  6:41 ` [patch net-next 3/3] net/sched: Change act_api and act_xxx modules " Chris Mi
  2 siblings, 1 reply; 49+ messages in thread
From: Chris Mi @ 2017-08-28  6:41 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, mawilcox

The following new APIs are added:

int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
                  unsigned long start, unsigned long end, gfp_t gfp);
static inline void *idr_remove_ext(struct idr *idr, unsigned long id);
static inline void *idr_find_ext(const struct idr *idr, unsigned long id);
void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);

Signed-off-by: Chris Mi <chrism@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 include/linux/idr.h        | 16 ++++++++++
 include/linux/radix-tree.h |  3 ++
 lib/idr.c                  | 56 +++++++++++++++++++++++++++++++++++
 lib/radix-tree.c           | 73 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 148 insertions(+)

diff --git a/include/linux/idr.h b/include/linux/idr.h
index bf70b3e..e0a030b 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -81,11 +81,15 @@ static inline void idr_set_cursor(struct idr *idr, unsigned int val)
 
 void idr_preload(gfp_t gfp_mask);
 int idr_alloc(struct idr *, void *entry, int start, int end, gfp_t);
+int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
+		  unsigned long start, unsigned long end, gfp_t gfp);
 int idr_alloc_cyclic(struct idr *, void *entry, int start, int end, gfp_t);
 int idr_for_each(const struct idr *,
 		 int (*fn)(int id, void *p, void *data), void *data);
 void *idr_get_next(struct idr *, int *nextid);
+void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
 void *idr_replace(struct idr *, void *, int id);
+void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
 void idr_destroy(struct idr *);
 
 static inline void *idr_remove(struct idr *idr, int id)
@@ -93,6 +97,11 @@ static inline void *idr_remove(struct idr *idr, int id)
 	return radix_tree_delete_item(&idr->idr_rt, id, NULL);
 }
 
+static inline void *idr_remove_ext(struct idr *idr, unsigned long id)
+{
+	return radix_tree_delete_item(&idr->idr_rt, id, NULL);
+}
+
 static inline void idr_init(struct idr *idr)
 {
 	INIT_RADIX_TREE(&idr->idr_rt, IDR_RT_MARKER);
@@ -133,6 +142,11 @@ static inline void *idr_find(const struct idr *idr, int id)
 	return radix_tree_lookup(&idr->idr_rt, id);
 }
 
+static inline void *idr_find_ext(const struct idr *idr, unsigned long id)
+{
+	return radix_tree_lookup(&idr->idr_rt, id);
+}
+
 /**
  * idr_for_each_entry - iterate over an idr's elements of a given type
  * @idr:     idr handle
@@ -145,6 +159,8 @@ static inline void *idr_find(const struct idr *idr, int id)
  */
 #define idr_for_each_entry(idr, entry, id)			\
 	for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; ++id)
+#define idr_for_each_entry_ext(idr, entry, id)			\
+	for (id = 0; ((entry) = idr_get_next_ext(idr, &(id))) != NULL; ++id)
 
 /**
  * idr_for_each_entry_continue - continue iteration over an idr's elements of a given type
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 3e57350..947299e 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -359,6 +359,9 @@ int radix_tree_join(struct radix_tree_root *, unsigned long index,
 			unsigned new_order, void *);
 void __rcu **idr_get_free(struct radix_tree_root *, struct radix_tree_iter *,
 			gfp_t, int end);
+void __rcu **idr_get_free_ext(struct radix_tree_root *root,
+			      struct radix_tree_iter *iter,
+			      gfp_t gfp, unsigned long end);
 
 enum {
 	RADIX_TREE_ITER_TAG_MASK = 0x0f,	/* tag index in lower nybble */
diff --git a/lib/idr.c b/lib/idr.c
index b13682b..2a091b9 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -47,6 +47,29 @@ int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp)
 }
 EXPORT_SYMBOL_GPL(idr_alloc);
 
+int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
+		  unsigned long start, unsigned long end, gfp_t gfp)
+{
+	void __rcu **slot;
+	struct radix_tree_iter iter;
+
+	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
+		return -EINVAL;
+
+	radix_tree_iter_init(&iter, start);
+	slot = idr_get_free_ext(&idr->idr_rt, &iter, gfp, end);
+	if (IS_ERR(slot))
+		return PTR_ERR(slot);
+
+	radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr);
+	radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE);
+
+	if (index)
+		*index = iter.index;
+	return 0;
+}
+EXPORT_SYMBOL_GPL(idr_alloc_ext);
+
 /**
  * idr_alloc_cyclic - allocate new idr entry in a cyclical fashion
  * @idr: idr handle
@@ -134,6 +157,20 @@ void *idr_get_next(struct idr *idr, int *nextid)
 }
 EXPORT_SYMBOL(idr_get_next);
 
+void *idr_get_next_ext(struct idr *idr, unsigned long *nextid)
+{
+	struct radix_tree_iter iter;
+	void __rcu **slot;
+
+	slot = radix_tree_iter_find(&idr->idr_rt, &iter, *nextid);
+	if (!slot)
+		return NULL;
+
+	*nextid = iter.index;
+	return rcu_dereference_raw(*slot);
+}
+EXPORT_SYMBOL(idr_get_next_ext);
+
 /**
  * idr_replace - replace pointer for given id
  * @idr: idr handle
@@ -169,6 +206,25 @@ void *idr_replace(struct idr *idr, void *ptr, int id)
 }
 EXPORT_SYMBOL(idr_replace);
 
+void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id)
+{
+	struct radix_tree_node *node;
+	void __rcu **slot = NULL;
+	void *entry;
+
+	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
+		return ERR_PTR(-EINVAL);
+
+	entry = __radix_tree_lookup(&idr->idr_rt, id, &node, &slot);
+	if (!slot || radix_tree_tag_get(&idr->idr_rt, id, IDR_FREE))
+		return ERR_PTR(-ENOENT);
+
+	__radix_tree_replace(&idr->idr_rt, node, slot, ptr, NULL, NULL);
+
+	return entry;
+}
+EXPORT_SYMBOL(idr_replace_ext);
+
 /**
  * DOC: IDA description
  *
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 898e879..06bfdbd 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -2208,6 +2208,79 @@ void __rcu **idr_get_free(struct radix_tree_root *root,
 	return slot;
 }
 
+void __rcu **idr_get_free_ext(struct radix_tree_root *root,
+			      struct radix_tree_iter *iter,
+			      gfp_t gfp, unsigned long end)
+{
+	struct radix_tree_node *node = NULL, *child;
+	void __rcu **slot = (void __rcu **)&root->rnode;
+	unsigned long maxindex, start = iter->next_index;
+	unsigned long max = end - 1;
+	unsigned int shift, offset = 0;
+
+ grow:
+	shift = radix_tree_load_root(root, &child, &maxindex);
+	if (!radix_tree_tagged(root, IDR_FREE))
+		start = max(start, maxindex + 1);
+	if (start > max)
+		return ERR_PTR(-ENOSPC);
+
+	if (start > maxindex) {
+		int error = radix_tree_extend(root, gfp, start, shift);
+
+		if (error < 0)
+			return ERR_PTR(error);
+		shift = error;
+		child = rcu_dereference_raw(root->rnode);
+	}
+
+	while (shift) {
+		shift -= RADIX_TREE_MAP_SHIFT;
+		if (child == NULL) {
+			/* Have to add a child node.  */
+			child = radix_tree_node_alloc(gfp, node, root, shift,
+						      offset, 0, 0);
+			if (!child)
+				return ERR_PTR(-ENOMEM);
+			all_tag_set(child, IDR_FREE);
+			rcu_assign_pointer(*slot, node_to_entry(child));
+			if (node)
+				node->count++;
+		} else if (!radix_tree_is_internal_node(child))
+			break;
+
+		node = entry_to_node(child);
+		offset = radix_tree_descend(node, &child, start);
+		if (!tag_get(node, IDR_FREE, offset)) {
+			offset = radix_tree_find_next_bit(node, IDR_FREE,
+							  offset + 1);
+			start = next_index(start, node, offset);
+			if (start > max)
+				return ERR_PTR(-ENOSPC);
+			while (offset == RADIX_TREE_MAP_SIZE) {
+				offset = node->offset + 1;
+				node = node->parent;
+				if (!node)
+					goto grow;
+				shift = node->shift;
+			}
+			child = rcu_dereference_raw(node->slots[offset]);
+		}
+		slot = &node->slots[offset];
+	}
+
+	iter->index = start;
+	if (node)
+		iter->next_index = 1 + min(max, (start | node_maxindex(node)));
+	else
+		iter->next_index = 1;
+	iter->node = node;
+	__set_iter_shift(iter, shift);
+	set_iter_tags(iter, node, offset, IDR_FREE);
+
+	return slot;
+}
+
 /**
  * idr_destroy - release all internal memory from an IDR
  * @idr: idr handle
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [patch net-next 2/3] net/sched: Change cls_flower to use IDR
  2017-08-28  6:41 [patch net-next 0/3] net/sched: Improve getting objects by indexes Chris Mi
  2017-08-28  6:41 ` [patch net-next 1/3] idr: Add new APIs to support unsigned long Chris Mi
@ 2017-08-28  6:41 ` Chris Mi
  2017-08-28 11:37   ` Simon Horman
  2017-08-28 21:55   ` Jamal Hadi Salim
  2017-08-28  6:41 ` [patch net-next 3/3] net/sched: Change act_api and act_xxx modules " Chris Mi
  2 siblings, 2 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-28  6:41 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, mawilcox

Currently, all filters with the same priority are linked in a doubly
linked list. Every filter should have a unique handle. To make the
handle unique, we need to iterate the list every time to see if the
handle exists or not when inserting a new filter. It is time-consuming.
For example, it takes about 5m3.169s to insert 64K rules.

This patch changes cls_flower to use IDR. With this patch, it
takes about 0m1.127s to insert 64K rules. The improvement is huge.

But please note that in this testing, all filters share the same action.
If every filter has a unique action, that is another bottleneck.
Follow-up patch in this patchset addresses that.

Signed-off-by: Chris Mi <chrism@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/sched/cls_flower.c | 55 +++++++++++++++++++++-----------------------------
 1 file changed, 23 insertions(+), 32 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index bd9dab4..3d041d2 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -68,7 +68,6 @@ struct cls_fl_head {
 	struct rhashtable ht;
 	struct fl_flow_mask mask;
 	struct flow_dissector dissector;
-	u32 hgen;
 	bool mask_assigned;
 	struct list_head filters;
 	struct rhashtable_params ht_params;
@@ -76,6 +75,7 @@ struct cls_fl_head {
 		struct work_struct work;
 		struct rcu_head	rcu;
 	};
+	struct idr handle_idr;
 };
 
 struct cls_fl_filter {
@@ -210,6 +210,7 @@ static int fl_init(struct tcf_proto *tp)
 
 	INIT_LIST_HEAD_RCU(&head->filters);
 	rcu_assign_pointer(tp->root, head);
+	idr_init(&head->handle_idr);
 
 	return 0;
 }
@@ -295,6 +296,9 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
 
 static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f)
 {
+	struct cls_fl_head *head = rtnl_dereference(tp->root);
+
+	idr_remove_ext(&head->handle_idr, f->handle);
 	list_del_rcu(&f->list);
 	if (!tc_skip_hw(f->flags))
 		fl_hw_destroy_filter(tp, f);
@@ -327,6 +331,7 @@ static void fl_destroy(struct tcf_proto *tp)
 
 	list_for_each_entry_safe(f, next, &head->filters, list)
 		__fl_delete(tp, f);
+	idr_destroy(&head->handle_idr);
 
 	__module_get(THIS_MODULE);
 	call_rcu(&head->rcu, fl_destroy_rcu);
@@ -335,12 +340,8 @@ static void fl_destroy(struct tcf_proto *tp)
 static void *fl_get(struct tcf_proto *tp, u32 handle)
 {
 	struct cls_fl_head *head = rtnl_dereference(tp->root);
-	struct cls_fl_filter *f;
 
-	list_for_each_entry(f, &head->filters, list)
-		if (f->handle == handle)
-			return f;
-	return NULL;
+	return idr_find_ext(&head->handle_idr, handle);
 }
 
 static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
@@ -859,27 +860,6 @@ static int fl_set_parms(struct net *net, struct tcf_proto *tp,
 	return 0;
 }
 
-static u32 fl_grab_new_handle(struct tcf_proto *tp,
-			      struct cls_fl_head *head)
-{
-	unsigned int i = 0x80000000;
-	u32 handle;
-
-	do {
-		if (++head->hgen == 0x7FFFFFFF)
-			head->hgen = 1;
-	} while (--i > 0 && fl_get(tp, head->hgen));
-
-	if (unlikely(i == 0)) {
-		pr_err("Insufficient number of handles\n");
-		handle = 0;
-	} else {
-		handle = head->hgen;
-	}
-
-	return handle;
-}
-
 static int fl_change(struct net *net, struct sk_buff *in_skb,
 		     struct tcf_proto *tp, unsigned long base,
 		     u32 handle, struct nlattr **tca,
@@ -890,6 +870,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 	struct cls_fl_filter *fnew;
 	struct nlattr **tb;
 	struct fl_flow_mask mask = {};
+	unsigned long idr_index;
 	int err;
 
 	if (!tca[TCA_OPTIONS])
@@ -920,13 +901,21 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 		goto errout;
 
 	if (!handle) {
-		handle = fl_grab_new_handle(tp, head);
-		if (!handle) {
-			err = -EINVAL;
+		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
+				    1, 0x80000000, GFP_KERNEL);
+		if (err)
 			goto errout;
-		}
+		fnew->handle = idr_index;
+	}
+
+	/* user specifies a handle and it doesn't exist */
+	if (handle && !fold) {
+		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
+				    handle, handle + 1, GFP_KERNEL);
+		if (err)
+			goto errout;
+		fnew->handle = idr_index;
 	}
-	fnew->handle = handle;
 
 	if (tb[TCA_FLOWER_FLAGS]) {
 		fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
@@ -980,6 +969,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 	*arg = fnew;
 
 	if (fold) {
+		fnew->handle = handle;
+		idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
 		list_replace_rcu(&fold->list, &fnew->list);
 		tcf_unbind_filter(tp, &fold->res);
 		call_rcu(&fold->rcu, fl_destroy_filter);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [patch net-next 3/3] net/sched: Change act_api and act_xxx modules to use IDR
  2017-08-28  6:41 [patch net-next 0/3] net/sched: Improve getting objects by indexes Chris Mi
  2017-08-28  6:41 ` [patch net-next 1/3] idr: Add new APIs to support unsigned long Chris Mi
  2017-08-28  6:41 ` [patch net-next 2/3] net/sched: Change cls_flower to use IDR Chris Mi
@ 2017-08-28  6:41 ` Chris Mi
  2017-08-28 21:56   ` Jamal Hadi Salim
  2 siblings, 1 reply; 49+ messages in thread
From: Chris Mi @ 2017-08-28  6:41 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, mawilcox

Typically, each TC filter has its own action. All the actions of the
same type are saved in its hash table. But the hash buckets are too
small that it degrades to a list. And the performance is greatly
affected. For example, it takes about 0m11.914s to insert 64K rules.
If we convert the hash table to IDR, it only takes about 0m1.500s.
The improvement is huge.

But please note that the test result is based on previous patch that
cls_flower uses IDR.

Signed-off-by: Chris Mi <chrism@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 include/net/act_api.h      |  76 +++++---------
 net/sched/act_api.c        | 251 ++++++++++++++++++++++-----------------------
 net/sched/act_bpf.c        |  17 ++-
 net/sched/act_connmark.c   |  16 ++-
 net/sched/act_csum.c       |  16 ++-
 net/sched/act_gact.c       |  16 ++-
 net/sched/act_ife.c        |  20 ++--
 net/sched/act_ipt.c        |  26 +++--
 net/sched/act_mirred.c     |  19 ++--
 net/sched/act_nat.c        |  16 ++-
 net/sched/act_pedit.c      |  18 ++--
 net/sched/act_police.c     |  18 ++--
 net/sched/act_sample.c     |  17 ++-
 net/sched/act_simple.c     |  20 ++--
 net/sched/act_skbedit.c    |  18 ++--
 net/sched/act_skbmod.c     |  18 ++--
 net/sched/act_tunnel_key.c |  20 ++--
 net/sched/act_vlan.c       |  22 ++--
 18 files changed, 279 insertions(+), 345 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 26ffd83..8f3d5d8 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -10,12 +10,9 @@
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
 
-
-struct tcf_hashinfo {
-	struct hlist_head	*htab;
-	unsigned int		hmask;
-	spinlock_t		lock;
-	u32			index;
+struct tcf_idrinfo {
+	spinlock_t	lock;
+	struct idr	action_idr;
 };
 
 struct tc_action_ops;
@@ -25,9 +22,8 @@ struct tc_action {
 	__u32				type; /* for backward compat(TCA_OLD_COMPAT) */
 	__u32				order;
 	struct list_head		list;
-	struct tcf_hashinfo		*hinfo;
+	struct tcf_idrinfo		*idrinfo;
 
-	struct hlist_node		tcfa_head;
 	u32				tcfa_index;
 	int				tcfa_refcnt;
 	int				tcfa_bindcnt;
@@ -44,7 +40,6 @@ struct tc_action {
 	struct tc_cookie	*act_cookie;
 	struct tcf_chain	*goto_chain;
 };
-#define tcf_head	common.tcfa_head
 #define tcf_index	common.tcfa_index
 #define tcf_refcnt	common.tcfa_refcnt
 #define tcf_bindcnt	common.tcfa_bindcnt
@@ -57,27 +52,6 @@ struct tc_action {
 #define tcf_lock	common.tcfa_lock
 #define tcf_rcu		common.tcfa_rcu
 
-static inline unsigned int tcf_hash(u32 index, unsigned int hmask)
-{
-	return index & hmask;
-}
-
-static inline int tcf_hashinfo_init(struct tcf_hashinfo *hf, unsigned int mask)
-{
-	int i;
-
-	spin_lock_init(&hf->lock);
-	hf->index = 0;
-	hf->hmask = mask;
-	hf->htab = kzalloc((mask + 1) * sizeof(struct hlist_head),
-			   GFP_KERNEL);
-	if (!hf->htab)
-		return -ENOMEM;
-	for (i = 0; i < mask + 1; i++)
-		INIT_HLIST_HEAD(&hf->htab[i]);
-	return 0;
-}
-
 /* Update lastuse only if needed, to avoid dirtying a cache line.
  * We use a temp variable to avoid fetching jiffies twice.
  */
@@ -126,53 +100,51 @@ struct tc_action_ops {
 };
 
 struct tc_action_net {
-	struct tcf_hashinfo *hinfo;
+	struct tcf_idrinfo *idrinfo;
 	const struct tc_action_ops *ops;
 };
 
 static inline
 int tc_action_net_init(struct tc_action_net *tn,
-		       const struct tc_action_ops *ops, unsigned int mask)
+		       const struct tc_action_ops *ops)
 {
 	int err = 0;
 
-	tn->hinfo = kmalloc(sizeof(*tn->hinfo), GFP_KERNEL);
-	if (!tn->hinfo)
+	tn->idrinfo = kmalloc(sizeof(*tn->idrinfo), GFP_KERNEL);
+	if (!tn->idrinfo)
 		return -ENOMEM;
 	tn->ops = ops;
-	err = tcf_hashinfo_init(tn->hinfo, mask);
-	if (err)
-		kfree(tn->hinfo);
+	spin_lock_init(&tn->idrinfo->lock);
+	idr_init(&tn->idrinfo->action_idr);
 	return err;
 }
 
-void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
-			  struct tcf_hashinfo *hinfo);
+void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
+			 struct tcf_idrinfo *idrinfo);
 
 static inline void tc_action_net_exit(struct tc_action_net *tn)
 {
-	tcf_hashinfo_destroy(tn->ops, tn->hinfo);
-	kfree(tn->hinfo);
+	tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
+	kfree(tn->idrinfo);
 }
 
 int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
 		       struct netlink_callback *cb, int type,
 		       const struct tc_action_ops *ops);
-int tcf_hash_search(struct tc_action_net *tn, struct tc_action **a, u32 index);
-u32 tcf_hash_new_index(struct tc_action_net *tn);
-bool tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
+int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index);
+bool tcf_idr_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
 		    int bind);
-int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
-		    struct tc_action **a, const struct tc_action_ops *ops, int bind,
-		    bool cpustats);
-void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est);
-void tcf_hash_insert(struct tc_action_net *tn, struct tc_action *a);
+int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
+		   struct tc_action **a, const struct tc_action_ops *ops,
+		   int bind, bool cpustats);
+void tcf_idr_cleanup(struct tc_action *a, struct nlattr *est);
+void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a);
 
-int __tcf_hash_release(struct tc_action *a, bool bind, bool strict);
+int __tcf_idr_release(struct tc_action *a, bool bind, bool strict);
 
-static inline int tcf_hash_release(struct tc_action *a, bool bind)
+static inline int tcf_idr_release(struct tc_action *a, bool bind)
 {
-	return __tcf_hash_release(a, bind, false);
+	return __tcf_idr_release(a, bind, false);
 }
 
 int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops);
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 02fcb0c..0eb545b 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -70,11 +70,11 @@ static void free_tcf(struct rcu_head *head)
 	kfree(p);
 }
 
-static void tcf_hash_destroy(struct tcf_hashinfo *hinfo, struct tc_action *p)
+static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p)
 {
-	spin_lock_bh(&hinfo->lock);
-	hlist_del(&p->tcfa_head);
-	spin_unlock_bh(&hinfo->lock);
+	spin_lock_bh(&idrinfo->lock);
+	idr_remove_ext(&idrinfo->action_idr, p->tcfa_index);
+	spin_unlock_bh(&idrinfo->lock);
 	gen_kill_estimator(&p->tcfa_rate_est);
 	/*
 	 * gen_estimator est_timer() might access p->tcfa_lock
@@ -83,7 +83,7 @@ static void tcf_hash_destroy(struct tcf_hashinfo *hinfo, struct tc_action *p)
 	call_rcu(&p->tcfa_rcu, free_tcf);
 }
 
-int __tcf_hash_release(struct tc_action *p, bool bind, bool strict)
+int __tcf_idr_release(struct tc_action *p, bool bind, bool strict)
 {
 	int ret = 0;
 
@@ -97,64 +97,60 @@ int __tcf_hash_release(struct tc_action *p, bool bind, bool strict)
 		if (p->tcfa_bindcnt <= 0 && p->tcfa_refcnt <= 0) {
 			if (p->ops->cleanup)
 				p->ops->cleanup(p, bind);
-			tcf_hash_destroy(p->hinfo, p);
+			tcf_idr_remove(p->idrinfo, p);
 			ret = ACT_P_DELETED;
 		}
 	}
 
 	return ret;
 }
-EXPORT_SYMBOL(__tcf_hash_release);
+EXPORT_SYMBOL(__tcf_idr_release);
 
-static int tcf_dump_walker(struct tcf_hashinfo *hinfo, struct sk_buff *skb,
+static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 			   struct netlink_callback *cb)
 {
-	int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;
+	int err = 0, index = -1, s_i = 0, n_i = 0;
 	u32 act_flags = cb->args[2];
 	unsigned long jiffy_since = cb->args[3];
 	struct nlattr *nest;
+	struct idr *idr = &idrinfo->action_idr;
+	struct tc_action *p;
+	unsigned long id = 1;
 
-	spin_lock_bh(&hinfo->lock);
+	spin_lock_bh(&idrinfo->lock);
 
 	s_i = cb->args[0];
 
-	for (i = 0; i < (hinfo->hmask + 1); i++) {
-		struct hlist_head *head;
-		struct tc_action *p;
-
-		head = &hinfo->htab[tcf_hash(i, hinfo->hmask)];
-
-		hlist_for_each_entry_rcu(p, head, tcfa_head) {
-			index++;
-			if (index < s_i)
-				continue;
-
-			if (jiffy_since &&
-			    time_after(jiffy_since,
-				       (unsigned long)p->tcfa_tm.lastuse))
-				continue;
-
-			nest = nla_nest_start(skb, n_i);
-			if (nest == NULL)
-				goto nla_put_failure;
-			err = tcf_action_dump_1(skb, p, 0, 0);
-			if (err < 0) {
-				index--;
-				nlmsg_trim(skb, nest);
-				goto done;
-			}
-			nla_nest_end(skb, nest);
-			n_i++;
-			if (!(act_flags & TCA_FLAG_LARGE_DUMP_ON) &&
-			    n_i >= TCA_ACT_MAX_PRIO)
-				goto done;
+	idr_for_each_entry_ext(idr, p, id) {
+		index++;
+		if (index < s_i)
+			continue;
+
+		if (jiffy_since &&
+		    time_after(jiffy_since,
+			       (unsigned long)p->tcfa_tm.lastuse))
+			continue;
+
+		nest = nla_nest_start(skb, n_i);
+		if (!nest)
+			goto nla_put_failure;
+		err = tcf_action_dump_1(skb, p, 0, 0);
+		if (err < 0) {
+			index--;
+			nlmsg_trim(skb, nest);
+			goto done;
 		}
+		nla_nest_end(skb, nest);
+		n_i++;
+		if (!(act_flags & TCA_FLAG_LARGE_DUMP_ON) &&
+		    n_i >= TCA_ACT_MAX_PRIO)
+			goto done;
 	}
 done:
 	if (index >= 0)
 		cb->args[0] = index + 1;
 
-	spin_unlock_bh(&hinfo->lock);
+	spin_unlock_bh(&idrinfo->lock);
 	if (n_i) {
 		if (act_flags & TCA_FLAG_LARGE_DUMP_ON)
 			cb->args[1] = n_i;
@@ -166,31 +162,29 @@ static int tcf_dump_walker(struct tcf_hashinfo *hinfo, struct sk_buff *skb,
 	goto done;
 }
 
-static int tcf_del_walker(struct tcf_hashinfo *hinfo, struct sk_buff *skb,
+static int tcf_del_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 			  const struct tc_action_ops *ops)
 {
 	struct nlattr *nest;
-	int i = 0, n_i = 0;
+	int n_i = 0;
 	int ret = -EINVAL;
+	struct idr *idr = &idrinfo->action_idr;
+	struct tc_action *p;
+	unsigned long id = 1;
 
 	nest = nla_nest_start(skb, 0);
 	if (nest == NULL)
 		goto nla_put_failure;
 	if (nla_put_string(skb, TCA_KIND, ops->kind))
 		goto nla_put_failure;
-	for (i = 0; i < (hinfo->hmask + 1); i++) {
-		struct hlist_head *head;
-		struct hlist_node *n;
-		struct tc_action *p;
-
-		head = &hinfo->htab[tcf_hash(i, hinfo->hmask)];
-		hlist_for_each_entry_safe(p, n, head, tcfa_head) {
-			ret = __tcf_hash_release(p, false, true);
-			if (ret == ACT_P_DELETED) {
-				module_put(p->ops->owner);
-				n_i++;
-			} else if (ret < 0)
-				goto nla_put_failure;
+
+	idr_for_each_entry_ext(idr, p, id) {
+		ret = __tcf_idr_release(p, false, true);
+		if (ret == ACT_P_DELETED) {
+			module_put(p->ops->owner);
+			n_i++;
+		} else if (ret < 0) {
+			goto nla_put_failure;
 		}
 	}
 	if (nla_put_u32(skb, TCA_FCNT, n_i))
@@ -207,12 +201,12 @@ int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
 		       struct netlink_callback *cb, int type,
 		       const struct tc_action_ops *ops)
 {
-	struct tcf_hashinfo *hinfo = tn->hinfo;
+	struct tcf_idrinfo *idrinfo = tn->idrinfo;
 
 	if (type == RTM_DELACTION) {
-		return tcf_del_walker(hinfo, skb, ops);
+		return tcf_del_walker(idrinfo, skb, ops);
 	} else if (type == RTM_GETACTION) {
-		return tcf_dump_walker(hinfo, skb, cb);
+		return tcf_dump_walker(idrinfo, skb, cb);
 	} else {
 		WARN(1, "tcf_generic_walker: unknown action %d\n", type);
 		return -EINVAL;
@@ -220,40 +214,21 @@ int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
 }
 EXPORT_SYMBOL(tcf_generic_walker);
 
-static struct tc_action *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
+static struct tc_action *tcf_idr_lookup(u32 index, struct tcf_idrinfo *idrinfo)
 {
 	struct tc_action *p = NULL;
-	struct hlist_head *head;
 
-	spin_lock_bh(&hinfo->lock);
-	head = &hinfo->htab[tcf_hash(index, hinfo->hmask)];
-	hlist_for_each_entry_rcu(p, head, tcfa_head)
-		if (p->tcfa_index == index)
-			break;
-	spin_unlock_bh(&hinfo->lock);
+	spin_lock_bh(&idrinfo->lock);
+	p = idr_find_ext(&idrinfo->action_idr, index);
+	spin_unlock_bh(&idrinfo->lock);
 
 	return p;
 }
 
-u32 tcf_hash_new_index(struct tc_action_net *tn)
-{
-	struct tcf_hashinfo *hinfo = tn->hinfo;
-	u32 val = hinfo->index;
-
-	do {
-		if (++val == 0)
-			val = 1;
-	} while (tcf_hash_lookup(val, hinfo));
-
-	hinfo->index = val;
-	return val;
-}
-EXPORT_SYMBOL(tcf_hash_new_index);
-
-int tcf_hash_search(struct tc_action_net *tn, struct tc_action **a, u32 index)
+int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index)
 {
-	struct tcf_hashinfo *hinfo = tn->hinfo;
-	struct tc_action *p = tcf_hash_lookup(index, hinfo);
+	struct tcf_idrinfo *idrinfo = tn->idrinfo;
+	struct tc_action *p = tcf_idr_lookup(index, idrinfo);
 
 	if (p) {
 		*a = p;
@@ -261,15 +236,15 @@ int tcf_hash_search(struct tc_action_net *tn, struct tc_action **a, u32 index)
 	}
 	return 0;
 }
-EXPORT_SYMBOL(tcf_hash_search);
+EXPORT_SYMBOL(tcf_idr_search);
 
-bool tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
-		    int bind)
+bool tcf_idr_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
+		   int bind)
 {
-	struct tcf_hashinfo *hinfo = tn->hinfo;
-	struct tc_action *p = NULL;
+	struct tcf_idrinfo *idrinfo = tn->idrinfo;
+	struct tc_action *p = tcf_idr_lookup(index, idrinfo);
 
-	if (index && (p = tcf_hash_lookup(index, hinfo)) != NULL) {
+	if (index && p) {
 		if (bind)
 			p->tcfa_bindcnt++;
 		p->tcfa_refcnt++;
@@ -278,23 +253,25 @@ bool tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
 	}
 	return false;
 }
-EXPORT_SYMBOL(tcf_hash_check);
+EXPORT_SYMBOL(tcf_idr_check);
 
-void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est)
+void tcf_idr_cleanup(struct tc_action *a, struct nlattr *est)
 {
 	if (est)
 		gen_kill_estimator(&a->tcfa_rate_est);
 	call_rcu(&a->tcfa_rcu, free_tcf);
 }
-EXPORT_SYMBOL(tcf_hash_cleanup);
+EXPORT_SYMBOL(tcf_idr_cleanup);
 
-int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
-		    struct tc_action **a, const struct tc_action_ops *ops,
-		    int bind, bool cpustats)
+int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
+		   struct tc_action **a, const struct tc_action_ops *ops,
+		   int bind, bool cpustats)
 {
 	struct tc_action *p = kzalloc(ops->size, GFP_KERNEL);
-	struct tcf_hashinfo *hinfo = tn->hinfo;
+	struct tcf_idrinfo *idrinfo = tn->idrinfo;
+	struct idr *idr = &idrinfo->action_idr;
 	int err = -ENOMEM;
+	unsigned long idr_index;
 
 	if (unlikely(!p))
 		return -ENOMEM;
@@ -317,8 +294,28 @@ int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
 		}
 	}
 	spin_lock_init(&p->tcfa_lock);
-	INIT_HLIST_NODE(&p->tcfa_head);
-	p->tcfa_index = index ? index : tcf_hash_new_index(tn);
+	/* user doesn't specify an index */
+	if (!index) {
+		spin_lock_bh(&idrinfo->lock);
+		err = idr_alloc_ext(idr, NULL, &idr_index, 1, 0,
+				    GFP_KERNEL);
+		spin_unlock_bh(&idrinfo->lock);
+		if (err) {
+err3:
+			free_percpu(p->cpu_qstats);
+			goto err2;
+		}
+		p->tcfa_index = idr_index;
+	} else {
+		spin_lock_bh(&idrinfo->lock);
+		err = idr_alloc_ext(idr, NULL, NULL, index, index + 1,
+				    GFP_KERNEL);
+		spin_unlock_bh(&idrinfo->lock);
+		if (err)
+			goto err3;
+		p->tcfa_index = index;
+	}
+
 	p->tcfa_tm.install = jiffies;
 	p->tcfa_tm.lastuse = jiffies;
 	p->tcfa_tm.firstuse = 0;
@@ -327,52 +324,46 @@ int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
 					&p->tcfa_rate_est,
 					&p->tcfa_lock, NULL, est);
 		if (err) {
-			free_percpu(p->cpu_qstats);
-			goto err2;
+			goto err3;
 		}
 	}
 
-	p->hinfo = hinfo;
+	p->idrinfo = idrinfo;
 	p->ops = ops;
 	INIT_LIST_HEAD(&p->list);
 	*a = p;
 	return 0;
 }
-EXPORT_SYMBOL(tcf_hash_create);
+EXPORT_SYMBOL(tcf_idr_create);
 
-void tcf_hash_insert(struct tc_action_net *tn, struct tc_action *a)
+void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a)
 {
-	struct tcf_hashinfo *hinfo = tn->hinfo;
-	unsigned int h = tcf_hash(a->tcfa_index, hinfo->hmask);
+	struct tcf_idrinfo *idrinfo = tn->idrinfo;
 
-	spin_lock_bh(&hinfo->lock);
-	hlist_add_head(&a->tcfa_head, &hinfo->htab[h]);
-	spin_unlock_bh(&hinfo->lock);
+	spin_lock_bh(&idrinfo->lock);
+	idr_replace_ext(&idrinfo->action_idr, a, a->tcfa_index);
+	spin_unlock_bh(&idrinfo->lock);
 }
-EXPORT_SYMBOL(tcf_hash_insert);
+EXPORT_SYMBOL(tcf_idr_insert);
 
-void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
-			  struct tcf_hashinfo *hinfo)
+void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
+			 struct tcf_idrinfo *idrinfo)
 {
-	int i;
-
-	for (i = 0; i < hinfo->hmask + 1; i++) {
-		struct tc_action *p;
-		struct hlist_node *n;
-
-		hlist_for_each_entry_safe(p, n, &hinfo->htab[i], tcfa_head) {
-			int ret;
+	struct idr *idr = &idrinfo->action_idr;
+	struct tc_action *p;
+	int ret;
+	unsigned long id = 1;
 
-			ret = __tcf_hash_release(p, false, true);
-			if (ret == ACT_P_DELETED)
-				module_put(ops->owner);
-			else if (ret < 0)
-				return;
-		}
+	idr_for_each_entry_ext(idr, p, id) {
+		ret = __tcf_idr_release(p, false, true);
+		if (ret == ACT_P_DELETED)
+			module_put(ops->owner);
+		else if (ret < 0)
+			return;
 	}
-	kfree(hinfo->htab);
+	idr_destroy(&idrinfo->action_idr);
 }
-EXPORT_SYMBOL(tcf_hashinfo_destroy);
+EXPORT_SYMBOL(tcf_idrinfo_destroy);
 
 static LIST_HEAD(act_base);
 static DEFINE_RWLOCK(act_mod_lock);
@@ -524,7 +515,7 @@ int tcf_action_destroy(struct list_head *actions, int bind)
 	int ret = 0;
 
 	list_for_each_entry_safe(a, tmp, actions, list) {
-		ret = __tcf_hash_release(a, bind, true);
+		ret = __tcf_idr_release(a, bind, true);
 		if (ret == ACT_P_DELETED)
 			module_put(a->ops->owner);
 		else if (ret < 0)
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index 9afe133..c0c707e 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -21,7 +21,6 @@
 #include <linux/tc_act/tc_bpf.h>
 #include <net/tc_act/tc_bpf.h>
 
-#define BPF_TAB_MASK		15
 #define ACT_BPF_NAME_LEN	256
 
 struct tcf_bpf_cfg {
@@ -295,9 +294,9 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
 
 	parm = nla_data(tb[TCA_ACT_BPF_PARMS]);
 
-	if (!tcf_hash_check(tn, parm->index, act, bind)) {
-		ret = tcf_hash_create(tn, parm->index, est, act,
-				      &act_bpf_ops, bind, true);
+	if (!tcf_idr_check(tn, parm->index, act, bind)) {
+		ret = tcf_idr_create(tn, parm->index, est, act,
+				     &act_bpf_ops, bind, true);
 		if (ret < 0)
 			return ret;
 
@@ -307,7 +306,7 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
 		if (bind)
 			return 0;
 
-		tcf_hash_release(*act, bind);
+		tcf_idr_release(*act, bind);
 		if (!replace)
 			return -EEXIST;
 	}
@@ -343,7 +342,7 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
 	rcu_assign_pointer(prog->filter, cfg.filter);
 
 	if (res == ACT_P_CREATED) {
-		tcf_hash_insert(tn, *act);
+		tcf_idr_insert(tn, *act);
 	} else {
 		/* make sure the program being replaced is no longer executing */
 		synchronize_rcu();
@@ -353,7 +352,7 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
 	return res;
 out:
 	if (res == ACT_P_CREATED)
-		tcf_hash_cleanup(*act, est);
+		tcf_idr_cleanup(*act, est);
 
 	return ret;
 }
@@ -379,7 +378,7 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, bpf_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_bpf_ops __read_mostly = {
@@ -399,7 +398,7 @@ static __net_init int bpf_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, bpf_net_id);
 
-	return tc_action_net_init(tn, &act_bpf_ops, BPF_TAB_MASK);
+	return tc_action_net_init(tn, &act_bpf_ops);
 }
 
 static void __net_exit bpf_exit_net(struct net *net)
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
index 2155bc6..10b7a88 100644
--- a/net/sched/act_connmark.c
+++ b/net/sched/act_connmark.c
@@ -28,8 +28,6 @@
 #include <net/netfilter/nf_conntrack_core.h>
 #include <net/netfilter/nf_conntrack_zones.h>
 
-#define CONNMARK_TAB_MASK     3
-
 static unsigned int connmark_net_id;
 static struct tc_action_ops act_connmark_ops;
 
@@ -119,9 +117,9 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
 
 	parm = nla_data(tb[TCA_CONNMARK_PARMS]);
 
-	if (!tcf_hash_check(tn, parm->index, a, bind)) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_connmark_ops, bind, false);
+	if (!tcf_idr_check(tn, parm->index, a, bind)) {
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_connmark_ops, bind, false);
 		if (ret)
 			return ret;
 
@@ -130,13 +128,13 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
 		ci->net = net;
 		ci->zone = parm->zone;
 
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 		ret = ACT_P_CREATED;
 	} else {
 		ci = to_connmark(*a);
 		if (bind)
 			return 0;
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 		/* replacing action and zone */
@@ -189,7 +187,7 @@ static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, connmark_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_connmark_ops = {
@@ -208,7 +206,7 @@ static __net_init int connmark_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, connmark_net_id);
 
-	return tc_action_net_init(tn, &act_connmark_ops, CONNMARK_TAB_MASK);
+	return tc_action_net_init(tn, &act_connmark_ops);
 }
 
 static void __net_exit connmark_exit_net(struct net *net)
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 67afc12..1c40caa 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -37,8 +37,6 @@
 #include <linux/tc_act/tc_csum.h>
 #include <net/tc_act/tc_csum.h>
 
-#define CSUM_TAB_MASK 15
-
 static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = {
 	[TCA_CSUM_PARMS] = { .len = sizeof(struct tc_csum), },
 };
@@ -67,16 +65,16 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 	parm = nla_data(tb[TCA_CSUM_PARMS]);
 
-	if (!tcf_hash_check(tn, parm->index, a, bind)) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_csum_ops, bind, false);
+	if (!tcf_idr_check(tn, parm->index, a, bind)) {
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_csum_ops, bind, false);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
 		if (bind)/* dont override defaults */
 			return 0;
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -88,7 +86,7 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
 	spin_unlock_bh(&p->tcf_lock);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 
 	return ret;
 }
@@ -609,7 +607,7 @@ static int tcf_csum_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, csum_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_csum_ops = {
@@ -628,7 +626,7 @@ static __net_init int csum_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, csum_net_id);
 
-	return tc_action_net_init(tn, &act_csum_ops, CSUM_TAB_MASK);
+	return tc_action_net_init(tn, &act_csum_ops);
 }
 
 static void __net_exit csum_exit_net(struct net *net)
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 99afe8b..e29a48e 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -23,8 +23,6 @@
 #include <linux/tc_act/tc_gact.h>
 #include <net/tc_act/tc_gact.h>
 
-#define GACT_TAB_MASK	15
-
 static unsigned int gact_net_id;
 static struct tc_action_ops act_gact_ops;
 
@@ -92,16 +90,16 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
 	}
 #endif
 
-	if (!tcf_hash_check(tn, parm->index, a, bind)) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_gact_ops, bind, true);
+	if (!tcf_idr_check(tn, parm->index, a, bind)) {
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_gact_ops, bind, true);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
 		if (bind)/* dont override defaults */
 			return 0;
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -122,7 +120,7 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
 	}
 #endif
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -214,7 +212,7 @@ static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, gact_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_gact_ops = {
@@ -234,7 +232,7 @@ static __net_init int gact_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, gact_net_id);
 
-	return tc_action_net_init(tn, &act_gact_ops, GACT_TAB_MASK);
+	return tc_action_net_init(tn, &act_gact_ops);
 }
 
 static void __net_exit gact_exit_net(struct net *net)
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index c5dec30..770c5d9 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -34,8 +34,6 @@
 #include <linux/etherdevice.h>
 #include <net/ife.h>
 
-#define IFE_TAB_MASK 15
-
 static unsigned int ife_net_id;
 static int max_metacnt = IFE_META_MAX + 1;
 static struct tc_action_ops act_ife_ops;
@@ -452,7 +450,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 
 	parm = nla_data(tb[TCA_IFE_PARMS]);
 
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
@@ -462,20 +460,20 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 		**/
 		if (!tb[TCA_IFE_TYPE]) {
 			if (exists)
-				tcf_hash_release(*a, bind);
+				tcf_idr_release(*a, bind);
 			pr_info("You MUST pass etherype for encoding\n");
 			return -EINVAL;
 		}
 	}
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a, &act_ife_ops,
-				      bind, false);
+		ret = tcf_idr_create(tn, parm->index, est, a, &act_ife_ops,
+				     bind, false);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -518,7 +516,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 		if (err) {
 metadata_parse_err:
 			if (exists)
-				tcf_hash_release(*a, bind);
+				tcf_idr_release(*a, bind);
 			if (ret == ACT_P_CREATED)
 				_tcf_ife_cleanup(*a, bind);
 
@@ -552,7 +550,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
 		spin_unlock_bh(&ife->tcf_lock);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 
 	return ret;
 }
@@ -811,7 +809,7 @@ static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, ife_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_ife_ops = {
@@ -831,7 +829,7 @@ static __net_init int ife_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, ife_net_id);
 
-	return tc_action_net_init(tn, &act_ife_ops, IFE_TAB_MASK);
+	return tc_action_net_init(tn, &act_ife_ops);
 }
 
 static void __net_exit ife_exit_net(struct net *net)
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 5417078..d9e399a 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -28,8 +28,6 @@
 #include <linux/netfilter_ipv4/ip_tables.h>
 
 
-#define IPT_TAB_MASK     15
-
 static unsigned int ipt_net_id;
 static struct tc_action_ops act_ipt_ops;
 
@@ -118,33 +116,33 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
 	if (tb[TCA_IPT_INDEX] != NULL)
 		index = nla_get_u32(tb[TCA_IPT_INDEX]);
 
-	exists = tcf_hash_check(tn, index, a, bind);
+	exists = tcf_idr_check(tn, index, a, bind);
 	if (exists && bind)
 		return 0;
 
 	if (tb[TCA_IPT_HOOK] == NULL || tb[TCA_IPT_TARG] == NULL) {
 		if (exists)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -EINVAL;
 	}
 
 	td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
 	if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) {
 		if (exists)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -EINVAL;
 	}
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, index, est, a, ops, bind,
-				      false);
+		ret = tcf_idr_create(tn, index, est, a, ops, bind,
+				     false);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
 		if (bind)/* dont override defaults */
 			return 0;
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 
 		if (!ovr)
 			return -EEXIST;
@@ -180,7 +178,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
 	ipt->tcfi_hook  = hook;
 	spin_unlock_bh(&ipt->tcf_lock);
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 
 err3:
@@ -189,7 +187,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
 	kfree(tname);
 err1:
 	if (ret == ACT_P_CREATED)
-		tcf_hash_cleanup(*a, est);
+		tcf_idr_cleanup(*a, est);
 	return err;
 }
 
@@ -316,7 +314,7 @@ static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, ipt_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_ipt_ops = {
@@ -336,7 +334,7 @@ static __net_init int ipt_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, ipt_net_id);
 
-	return tc_action_net_init(tn, &act_ipt_ops, IPT_TAB_MASK);
+	return tc_action_net_init(tn, &act_ipt_ops);
 }
 
 static void __net_exit ipt_exit_net(struct net *net)
@@ -366,7 +364,7 @@ static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, xt_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_xt_ops = {
@@ -386,7 +384,7 @@ static __net_init int xt_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, xt_net_id);
 
-	return tc_action_net_init(tn, &act_xt_ops, IPT_TAB_MASK);
+	return tc_action_net_init(tn, &act_xt_ops);
 }
 
 static void __net_exit xt_exit_net(struct net *net)
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 1b5549a..416627c 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -28,7 +28,6 @@
 #include <linux/tc_act/tc_mirred.h>
 #include <net/tc_act/tc_mirred.h>
 
-#define MIRRED_TAB_MASK     7
 static LIST_HEAD(mirred_list);
 static DEFINE_SPINLOCK(mirred_list_lock);
 
@@ -94,7 +93,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 	parm = nla_data(tb[TCA_MIRRED_PARMS]);
 
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
@@ -106,14 +105,14 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 		break;
 	default:
 		if (exists)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -EINVAL;
 	}
 	if (parm->ifindex) {
 		dev = __dev_get_by_index(net, parm->ifindex);
 		if (dev == NULL) {
 			if (exists)
-				tcf_hash_release(*a, bind);
+				tcf_idr_release(*a, bind);
 			return -ENODEV;
 		}
 		mac_header_xmit = dev_is_mac_header_xmit(dev);
@@ -124,13 +123,13 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 	if (!exists) {
 		if (dev == NULL)
 			return -EINVAL;
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_mirred_ops, bind, true);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_mirred_ops, bind, true);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -152,7 +151,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 		spin_lock_bh(&mirred_list_lock);
 		list_add(&m->tcfm_list, &mirred_list);
 		spin_unlock_bh(&mirred_list_lock);
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	}
 
 	return ret;
@@ -283,7 +282,7 @@ static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, mirred_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static int mirred_device_event(struct notifier_block *unused,
@@ -344,7 +343,7 @@ static __net_init int mirred_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, mirred_net_id);
 
-	return tc_action_net_init(tn, &act_mirred_ops, MIRRED_TAB_MASK);
+	return tc_action_net_init(tn, &act_mirred_ops);
 }
 
 static void __net_exit mirred_exit_net(struct net *net)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 9016ab8..c365d01 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -29,8 +29,6 @@
 #include <net/udp.h>
 
 
-#define NAT_TAB_MASK	15
-
 static unsigned int nat_net_id;
 static struct tc_action_ops act_nat_ops;
 
@@ -58,16 +56,16 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
 		return -EINVAL;
 	parm = nla_data(tb[TCA_NAT_PARMS]);
 
-	if (!tcf_hash_check(tn, parm->index, a, bind)) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_nat_ops, bind, false);
+	if (!tcf_idr_check(tn, parm->index, a, bind)) {
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_nat_ops, bind, false);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
 		if (bind)
 			return 0;
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -83,7 +81,7 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
 	spin_unlock_bh(&p->tcf_lock);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 
 	return ret;
 }
@@ -290,7 +288,7 @@ static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, nat_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_nat_ops = {
@@ -309,7 +307,7 @@ static __net_init int nat_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, nat_net_id);
 
-	return tc_action_net_init(tn, &act_nat_ops, NAT_TAB_MASK);
+	return tc_action_net_init(tn, &act_nat_ops);
 }
 
 static void __net_exit nat_exit_net(struct net *net)
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 7dc5892..491fe5de 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -24,8 +24,6 @@
 #include <net/tc_act/tc_pedit.h>
 #include <uapi/linux/tc_act/tc_pedit.h>
 
-#define PEDIT_TAB_MASK	15
-
 static unsigned int pedit_net_id;
 static struct tc_action_ops act_pedit_ops;
 
@@ -168,17 +166,17 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
 	if (IS_ERR(keys_ex))
 		return PTR_ERR(keys_ex);
 
-	if (!tcf_hash_check(tn, parm->index, a, bind)) {
+	if (!tcf_idr_check(tn, parm->index, a, bind)) {
 		if (!parm->nkeys)
 			return -EINVAL;
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_pedit_ops, bind, false);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_pedit_ops, bind, false);
 		if (ret)
 			return ret;
 		p = to_pedit(*a);
 		keys = kmalloc(ksize, GFP_KERNEL);
 		if (keys == NULL) {
-			tcf_hash_cleanup(*a, est);
+			tcf_idr_cleanup(*a, est);
 			kfree(keys_ex);
 			return -ENOMEM;
 		}
@@ -186,7 +184,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
 	} else {
 		if (bind)
 			return 0;
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 		p = to_pedit(*a);
@@ -214,7 +212,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
 
 	spin_unlock_bh(&p->tcf_lock);
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -432,7 +430,7 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, pedit_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_pedit_ops = {
@@ -452,7 +450,7 @@ static __net_init int pedit_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, pedit_net_id);
 
-	return tc_action_net_init(tn, &act_pedit_ops, PEDIT_TAB_MASK);
+	return tc_action_net_init(tn, &act_pedit_ops);
 }
 
 static void __net_exit pedit_exit_net(struct net *net)
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index b062bc8..3bb2ebf 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -40,8 +40,6 @@ struct tcf_police {
 
 #define to_police(pc) ((struct tcf_police *)pc)
 
-#define POL_TAB_MASK     15
-
 /* old policer structure from before tc actions */
 struct tc_police_compat {
 	u32			index;
@@ -101,18 +99,18 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 
 	parm = nla_data(tb[TCA_POLICE_TBF]);
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, NULL, a,
-				      &act_police_ops, bind, false);
+		ret = tcf_idr_create(tn, parm->index, NULL, a,
+				     &act_police_ops, bind, false);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -188,7 +186,7 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla,
 		return ret;
 
 	police->tcfp_t_c = ktime_get_ns();
-	tcf_hash_insert(tn, *a);
+	tcf_idr_insert(tn, *a);
 
 	return ret;
 
@@ -196,7 +194,7 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla,
 	qdisc_put_rtab(P_tab);
 	qdisc_put_rtab(R_tab);
 	if (ret == ACT_P_CREATED)
-		tcf_hash_cleanup(*a, est);
+		tcf_idr_cleanup(*a, est);
 	return err;
 }
 
@@ -310,7 +308,7 @@ static int tcf_police_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, police_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 MODULE_AUTHOR("Alexey Kuznetsov");
@@ -333,7 +331,7 @@ static __net_init int police_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, police_net_id);
 
-	return tc_action_net_init(tn, &act_police_ops, POL_TAB_MASK);
+	return tc_action_net_init(tn, &act_police_ops);
 }
 
 static void __net_exit police_exit_net(struct net *net)
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 59d6645..ec986ae 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -25,7 +25,6 @@
 
 #include <linux/if_arp.h>
 
-#define SAMPLE_TAB_MASK     7
 static unsigned int sample_net_id;
 static struct tc_action_ops act_sample_ops;
 
@@ -59,18 +58,18 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 
 	parm = nla_data(tb[TCA_SAMPLE_PARMS]);
 
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_sample_ops, bind, false);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_sample_ops, bind, false);
 		if (ret)
 			return ret;
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -82,7 +81,7 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 	psample_group = psample_group_get(net, s->psample_group_num);
 	if (!psample_group) {
 		if (ret == ACT_P_CREATED)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -ENOMEM;
 	}
 	RCU_INIT_POINTER(s->psample_group, psample_group);
@@ -93,7 +92,7 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 	}
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -221,7 +220,7 @@ static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, sample_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_sample_ops = {
@@ -241,7 +240,7 @@ static __net_init int sample_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, sample_net_id);
 
-	return tc_action_net_init(tn, &act_sample_ops, SAMPLE_TAB_MASK);
+	return tc_action_net_init(tn, &act_sample_ops);
 }
 
 static void __net_exit sample_exit_net(struct net *net)
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 43605e7..e7b57e5 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -24,8 +24,6 @@
 #include <linux/tc_act/tc_defact.h>
 #include <net/tc_act/tc_defact.h>
 
-#define SIMP_TAB_MASK     7
-
 static unsigned int simp_net_id;
 static struct tc_action_ops act_simp_ops;
 
@@ -102,28 +100,28 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 
 	parm = nla_data(tb[TCA_DEF_PARMS]);
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
 	if (tb[TCA_DEF_DATA] == NULL) {
 		if (exists)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -EINVAL;
 	}
 
 	defdata = nla_data(tb[TCA_DEF_DATA]);
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_simp_ops, bind, false);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_simp_ops, bind, false);
 		if (ret)
 			return ret;
 
 		d = to_defact(*a);
 		ret = alloc_defdata(d, defdata);
 		if (ret < 0) {
-			tcf_hash_cleanup(*a, est);
+			tcf_idr_cleanup(*a, est);
 			return ret;
 		}
 		d->tcf_action = parm->action;
@@ -131,7 +129,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
 	} else {
 		d = to_defact(*a);
 
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 
@@ -139,7 +137,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
 	}
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -183,7 +181,7 @@ static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, simp_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_simp_ops = {
@@ -203,7 +201,7 @@ static __net_init int simp_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, simp_net_id);
 
-	return tc_action_net_init(tn, &act_simp_ops, SIMP_TAB_MASK);
+	return tc_action_net_init(tn, &act_simp_ops);
 }
 
 static void __net_exit simp_exit_net(struct net *net)
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 6b3e65d..59949d6 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -27,8 +27,6 @@
 #include <linux/tc_act/tc_skbedit.h>
 #include <net/tc_act/tc_skbedit.h>
 
-#define SKBEDIT_TAB_MASK     15
-
 static unsigned int skbedit_net_id;
 static struct tc_action_ops act_skbedit_ops;
 
@@ -118,18 +116,18 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 
 	parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
 
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
 	if (!flags) {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		return -EINVAL;
 	}
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_skbedit_ops, bind, false);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_skbedit_ops, bind, false);
 		if (ret)
 			return ret;
 
@@ -137,7 +135,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 		ret = ACT_P_CREATED;
 	} else {
 		d = to_skbedit(*a);
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -163,7 +161,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 	spin_unlock_bh(&d->tcf_lock);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -221,7 +219,7 @@ static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, skbedit_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_skbedit_ops = {
@@ -240,7 +238,7 @@ static __net_init int skbedit_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, skbedit_net_id);
 
-	return tc_action_net_init(tn, &act_skbedit_ops, SKBEDIT_TAB_MASK);
+	return tc_action_net_init(tn, &act_skbedit_ops);
 }
 
 static void __net_exit skbedit_exit_net(struct net *net)
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index a73c4bb..b642ad3 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -20,8 +20,6 @@
 #include <linux/tc_act/tc_skbmod.h>
 #include <net/tc_act/tc_skbmod.h>
 
-#define SKBMOD_TAB_MASK     15
-
 static unsigned int skbmod_net_id;
 static struct tc_action_ops act_skbmod_ops;
 
@@ -129,7 +127,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
 	if (parm->flags & SKBMOD_F_SWAPMAC)
 		lflags = SKBMOD_F_SWAPMAC;
 
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
@@ -137,14 +135,14 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_skbmod_ops, bind, true);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_skbmod_ops, bind, true);
 		if (ret)
 			return ret;
 
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -155,7 +153,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
 	p = kzalloc(sizeof(struct tcf_skbmod_params), GFP_KERNEL);
 	if (unlikely(!p)) {
 		if (ovr)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -ENOMEM;
 	}
 
@@ -182,7 +180,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
 		kfree_rcu(p_old, rcu);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -245,7 +243,7 @@ static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, skbmod_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_skbmod_ops = {
@@ -265,7 +263,7 @@ static __net_init int skbmod_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, skbmod_net_id);
 
-	return tc_action_net_init(tn, &act_skbmod_ops, SKBMOD_TAB_MASK);
+	return tc_action_net_init(tn, &act_skbmod_ops);
 }
 
 static void __net_exit skbmod_exit_net(struct net *net)
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index fd7e756..30c9627 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -20,8 +20,6 @@
 #include <linux/tc_act/tc_tunnel_key.h>
 #include <net/tc_act/tc_tunnel_key.h>
 
-#define TUNNEL_KEY_TAB_MASK     15
-
 static unsigned int tunnel_key_net_id;
 static struct tc_action_ops act_tunnel_key_ops;
 
@@ -100,7 +98,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 		return -EINVAL;
 
 	parm = nla_data(tb[TCA_TUNNEL_KEY_PARMS]);
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
@@ -159,14 +157,14 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 	}
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_tunnel_key_ops, bind, true);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_tunnel_key_ops, bind, true);
 		if (ret)
 			return ret;
 
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -177,7 +175,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 	params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
 	if (unlikely(!params_new)) {
 		if (ret == ACT_P_CREATED)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -ENOMEM;
 	}
 
@@ -193,13 +191,13 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 		kfree_rcu(params_old, rcu);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 
 	return ret;
 
 err_out:
 	if (exists)
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 	return ret;
 }
 
@@ -304,7 +302,7 @@ static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_tunnel_key_ops = {
@@ -324,7 +322,7 @@ static __net_init int tunnel_key_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
 
-	return tc_action_net_init(tn, &act_tunnel_key_ops, TUNNEL_KEY_TAB_MASK);
+	return tc_action_net_init(tn, &act_tunnel_key_ops);
 }
 
 static void __net_exit tunnel_key_exit_net(struct net *net)
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 13ba3a8..16eb067 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -19,8 +19,6 @@
 #include <linux/tc_act/tc_vlan.h>
 #include <net/tc_act/tc_vlan.h>
 
-#define VLAN_TAB_MASK     15
-
 static unsigned int vlan_net_id;
 static struct tc_action_ops act_vlan_ops;
 
@@ -128,7 +126,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
 	if (!tb[TCA_VLAN_PARMS])
 		return -EINVAL;
 	parm = nla_data(tb[TCA_VLAN_PARMS]);
-	exists = tcf_hash_check(tn, parm->index, a, bind);
+	exists = tcf_idr_check(tn, parm->index, a, bind);
 	if (exists && bind)
 		return 0;
 
@@ -139,13 +137,13 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
 	case TCA_VLAN_ACT_MODIFY:
 		if (!tb[TCA_VLAN_PUSH_VLAN_ID]) {
 			if (exists)
-				tcf_hash_release(*a, bind);
+				tcf_idr_release(*a, bind);
 			return -EINVAL;
 		}
 		push_vid = nla_get_u16(tb[TCA_VLAN_PUSH_VLAN_ID]);
 		if (push_vid >= VLAN_VID_MASK) {
 			if (exists)
-				tcf_hash_release(*a, bind);
+				tcf_idr_release(*a, bind);
 			return -ERANGE;
 		}
 
@@ -167,20 +165,20 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
 		break;
 	default:
 		if (exists)
-			tcf_hash_release(*a, bind);
+			tcf_idr_release(*a, bind);
 		return -EINVAL;
 	}
 	action = parm->v_action;
 
 	if (!exists) {
-		ret = tcf_hash_create(tn, parm->index, est, a,
-				      &act_vlan_ops, bind, false);
+		ret = tcf_idr_create(tn, parm->index, est, a,
+				     &act_vlan_ops, bind, false);
 		if (ret)
 			return ret;
 
 		ret = ACT_P_CREATED;
 	} else {
-		tcf_hash_release(*a, bind);
+		tcf_idr_release(*a, bind);
 		if (!ovr)
 			return -EEXIST;
 	}
@@ -199,7 +197,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
 	spin_unlock_bh(&v->tcf_lock);
 
 	if (ret == ACT_P_CREATED)
-		tcf_hash_insert(tn, *a);
+		tcf_idr_insert(tn, *a);
 	return ret;
 }
 
@@ -252,7 +250,7 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index)
 {
 	struct tc_action_net *tn = net_generic(net, vlan_net_id);
 
-	return tcf_hash_search(tn, a, index);
+	return tcf_idr_search(tn, a, index);
 }
 
 static struct tc_action_ops act_vlan_ops = {
@@ -271,7 +269,7 @@ static __net_init int vlan_init_net(struct net *net)
 {
 	struct tc_action_net *tn = net_generic(net, vlan_net_id);
 
-	return tc_action_net_init(tn, &act_vlan_ops, VLAN_TAB_MASK);
+	return tc_action_net_init(tn, &act_vlan_ops);
 }
 
 static void __net_exit vlan_exit_net(struct net *net)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
  2017-08-28  6:41 ` [patch net-next 2/3] net/sched: Change cls_flower to use IDR Chris Mi
@ 2017-08-28 11:37   ` Simon Horman
  2017-08-29  3:25     ` Chris Mi
  2017-08-28 21:55   ` Jamal Hadi Salim
  1 sibling, 1 reply; 49+ messages in thread
From: Simon Horman @ 2017-08-28 11:37 UTC (permalink / raw)
  To: Chris Mi; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem, mawilcox

On Mon, Aug 28, 2017 at 02:41:16AM -0400, Chris Mi wrote:
> Currently, all filters with the same priority are linked in a doubly
> linked list. Every filter should have a unique handle. To make the
> handle unique, we need to iterate the list every time to see if the
> handle exists or not when inserting a new filter. It is time-consuming.
> For example, it takes about 5m3.169s to insert 64K rules.
> 
> This patch changes cls_flower to use IDR. With this patch, it
> takes about 0m1.127s to insert 64K rules. The improvement is huge.

Very nice :)

> But please note that in this testing, all filters share the same action.
> If every filter has a unique action, that is another bottleneck.
> Follow-up patch in this patchset addresses that.
> 
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  net/sched/cls_flower.c | 55 +++++++++++++++++++++-----------------------------
>  1 file changed, 23 insertions(+), 32 deletions(-)
> 
> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index bd9dab4..3d041d2 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c

...

> @@ -890,6 +870,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
>  	struct cls_fl_filter *fnew;
>  	struct nlattr **tb;
>  	struct fl_flow_mask mask = {};
> +	unsigned long idr_index;
>  	int err;
>  
>  	if (!tca[TCA_OPTIONS])
> @@ -920,13 +901,21 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
>  		goto errout;
>  
>  	if (!handle) {
> -		handle = fl_grab_new_handle(tp, head);
> -		if (!handle) {
> -			err = -EINVAL;
> +		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> +				    1, 0x80000000, GFP_KERNEL);
> +		if (err)
>  			goto errout;
> -		}
> +		fnew->handle = idr_index;
> +	}
> +
> +	/* user specifies a handle and it doesn't exist */
> +	if (handle && !fold) {
> +		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> +				    handle, handle + 1, GFP_KERNEL);
> +		if (err)
> +			goto errout;
> +		fnew->handle = idr_index;
>  	}
> -	fnew->handle = handle;
>  
>  	if (tb[TCA_FLOWER_FLAGS]) {
>  		fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
> @@ -980,6 +969,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
>  	*arg = fnew;
>  
>  	if (fold) {
> +		fnew->handle = handle;

Can it be the case that fold is non-NULL and handle is zero?
The handling of that case seem to have changed in this patch.

> +		idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
>  		list_replace_rcu(&fold->list, &fnew->list);
>  		tcf_unbind_filter(tp, &fold->res);
>  		call_rcu(&fold->rcu, fl_destroy_filter);
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
  2017-08-28  6:41 ` [patch net-next 2/3] net/sched: Change cls_flower to use IDR Chris Mi
  2017-08-28 11:37   ` Simon Horman
@ 2017-08-28 21:55   ` Jamal Hadi Salim
  2017-08-29  1:34     ` Chris Mi
  1 sibling, 1 reply; 49+ messages in thread
From: Jamal Hadi Salim @ 2017-08-28 21:55 UTC (permalink / raw)
  To: Chris Mi, netdev; +Cc: xiyou.wangcong, jiri, davem, mawilcox

On 17-08-28 02:41 AM, Chris Mi wrote:
> Currently, all filters with the same priority are linked in a doubly
> linked list. Every filter should have a unique handle. To make the
> handle unique, we need to iterate the list every time to see if the
> handle exists or not when inserting a new filter. It is time-consuming.
> For example, it takes about 5m3.169s to insert 64K rules.
> 
> This patch changes cls_flower to use IDR. With this patch, it
> takes about 0m1.127s to insert 64K rules. The improvement is huge.
> 
> But please note that in this testing, all filters share the same action.
> If every filter has a unique action, that is another bottleneck.
> Follow-up patch in this patchset addresses that.
> 
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

As Cong asked last time - any plans to add to other classifiers?

cheers,
jamal

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 3/3] net/sched: Change act_api and act_xxx modules to use IDR
  2017-08-28  6:41 ` [patch net-next 3/3] net/sched: Change act_api and act_xxx modules " Chris Mi
@ 2017-08-28 21:56   ` Jamal Hadi Salim
  0 siblings, 0 replies; 49+ messages in thread
From: Jamal Hadi Salim @ 2017-08-28 21:56 UTC (permalink / raw)
  To: Chris Mi, netdev; +Cc: xiyou.wangcong, jiri, davem, mawilcox

On 17-08-28 02:41 AM, Chris Mi wrote:
> Typically, each TC filter has its own action. All the actions of the
> same type are saved in its hash table. But the hash buckets are too
> small that it degrades to a list. And the performance is greatly
> affected. For example, it takes about 0m11.914s to insert 64K rules.
> If we convert the hash table to IDR, it only takes about 0m1.500s.
> The improvement is huge.
> 
> But please note that the test result is based on previous patch that
> cls_flower uses IDR.
> 
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
  2017-08-28 21:55   ` Jamal Hadi Salim
@ 2017-08-29  1:34     ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-29  1:34 UTC (permalink / raw)
  To: Jamal Hadi Salim, netdev; +Cc: xiyou.wangcong, jiri, davem, mawilcox

> -----Original Message-----
> From: Jamal Hadi Salim [mailto:jhs@mojatatu.com]
> Sent: Tuesday, August 29, 2017 5:56 AM
> To: Chris Mi <chrism@mellanox.com>; netdev@vger.kernel.org
> Cc: xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> mawilcox@microsoft.com
> Subject: Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
> 
> On 17-08-28 02:41 AM, Chris Mi wrote:
> > Currently, all filters with the same priority are linked in a doubly
> > linked list. Every filter should have a unique handle. To make the
> > handle unique, we need to iterate the list every time to see if the
> > handle exists or not when inserting a new filter. It is time-consuming.
> > For example, it takes about 5m3.169s to insert 64K rules.
> >
> > This patch changes cls_flower to use IDR. With this patch, it takes
> > about 0m1.127s to insert 64K rules. The improvement is huge.
> >
> > But please note that in this testing, all filters share the same action.
> > If every filter has a unique action, that is another bottleneck.
> > Follow-up patch in this patchset addresses that.
> >
> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> 
> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
> 
> As Cong asked last time - any plans to add to other classifiers?
I think if other classifiers don't need so many items, list is enough for them.
If we change all of them, we need spend a lot of time to test them to make sure
there is no regression. But the benefit is not very big. If a certain classifier
need to change in the future, flower is an example for reference.

-Chris
> 
> cheers,
> jamal

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
  2017-08-28 11:37   ` Simon Horman
@ 2017-08-29  3:25     ` Chris Mi
  2017-08-30 10:30       ` Simon Horman
  0 siblings, 1 reply; 49+ messages in thread
From: Chris Mi @ 2017-08-29  3:25 UTC (permalink / raw)
  To: Simon Horman; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem, mawilcox



> -----Original Message-----
> From: Simon Horman [mailto:simon.horman@netronome.com]
> Sent: Monday, August 28, 2017 7:37 PM
> To: Chris Mi <chrism@mellanox.com>
> Cc: netdev@vger.kernel.org; jhs@mojatatu.com;
> xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> mawilcox@microsoft.com
> Subject: Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
> 
> On Mon, Aug 28, 2017 at 02:41:16AM -0400, Chris Mi wrote:
> > Currently, all filters with the same priority are linked in a doubly
> > linked list. Every filter should have a unique handle. To make the
> > handle unique, we need to iterate the list every time to see if the
> > handle exists or not when inserting a new filter. It is time-consuming.
> > For example, it takes about 5m3.169s to insert 64K rules.
> >
> > This patch changes cls_flower to use IDR. With this patch, it takes
> > about 0m1.127s to insert 64K rules. The improvement is huge.
> 
> Very nice :)
> 
> > But please note that in this testing, all filters share the same action.
> > If every filter has a unique action, that is another bottleneck.
> > Follow-up patch in this patchset addresses that.
> >
> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> >  net/sched/cls_flower.c | 55
> > +++++++++++++++++++++-----------------------------
> >  1 file changed, 23 insertions(+), 32 deletions(-)
> >
> > diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index
> > bd9dab4..3d041d2 100644
> > --- a/net/sched/cls_flower.c
> > +++ b/net/sched/cls_flower.c
> 
> ...
> 
> > @@ -890,6 +870,7 @@ static int fl_change(struct net *net, struct sk_buff
> *in_skb,
> >  	struct cls_fl_filter *fnew;
> >  	struct nlattr **tb;
> >  	struct fl_flow_mask mask = {};
> > +	unsigned long idr_index;
> >  	int err;
> >
> >  	if (!tca[TCA_OPTIONS])
> > @@ -920,13 +901,21 @@ static int fl_change(struct net *net, struct sk_buff
> *in_skb,
> >  		goto errout;
> >
> >  	if (!handle) {
> > -		handle = fl_grab_new_handle(tp, head);
> > -		if (!handle) {
> > -			err = -EINVAL;
> > +		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> > +				    1, 0x80000000, GFP_KERNEL);
> > +		if (err)
> >  			goto errout;
> > -		}
> > +		fnew->handle = idr_index;
> > +	}
> > +
> > +	/* user specifies a handle and it doesn't exist */
> > +	if (handle && !fold) {
> > +		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> > +				    handle, handle + 1, GFP_KERNEL);
> > +		if (err)
> > +			goto errout;
> > +		fnew->handle = idr_index;
> >  	}
> > -	fnew->handle = handle;
> >
> >  	if (tb[TCA_FLOWER_FLAGS]) {
> >  		fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
> > @@ -980,6 +969,8 @@ static int fl_change(struct net *net, struct sk_buff
> *in_skb,
> >  	*arg = fnew;
> >
> >  	if (fold) {
> > +		fnew->handle = handle;
> 
> Can it be the case that fold is non-NULL and handle is zero?
> The handling of that case seem to have changed in this patch.
I don't think that could happen.  In function tc_ctl_tfilter(),

fl_get() will be called.  If handle is zero, fl_get() will return NULL.
That means fold is NULL.

> 
> > +		idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
> >  		list_replace_rcu(&fold->list, &fnew->list);
> >  		tcf_unbind_filter(tp, &fold->res);
> >  		call_rcu(&fold->rcu, fl_destroy_filter);
> > --
> > 1.8.3.1
> >

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 1/3] idr: Add new APIs to support unsigned long
  2017-08-28  6:41 ` [patch net-next 1/3] idr: Add new APIs to support unsigned long Chris Mi
@ 2017-08-29  7:14   ` Hannes Frederic Sowa
  2017-08-29  7:34     ` Chris Mi
  2017-08-29  7:56     ` Jiri Pirko
  0 siblings, 2 replies; 49+ messages in thread
From: Hannes Frederic Sowa @ 2017-08-29  7:14 UTC (permalink / raw)
  To: Chris Mi; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem, mawilcox

Hello,

Chris Mi <chrism@mellanox.com> writes:

> The following new APIs are added:
>
> int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
>                   unsigned long start, unsigned long end, gfp_t gfp);
> static inline void *idr_remove_ext(struct idr *idr, unsigned long id);
> static inline void *idr_find_ext(const struct idr *idr, unsigned long id);
> void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
> void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
>
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  include/linux/idr.h        | 16 ++++++++++
>  include/linux/radix-tree.h |  3 ++
>  lib/idr.c                  | 56 +++++++++++++++++++++++++++++++++++
>  lib/radix-tree.c           | 73 ++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 148 insertions(+)
>

[...]

> +int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
> +		  unsigned long start, unsigned long end, gfp_t gfp)
> +{
> +	void __rcu **slot;
> +	struct radix_tree_iter iter;
> +
> +	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
> +		return -EINVAL;
> +
> +	radix_tree_iter_init(&iter, start);
> +	slot = idr_get_free_ext(&idr->idr_rt, &iter, gfp, end);
> +	if (IS_ERR(slot))
> +		return PTR_ERR(slot);
> +
> +	radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr);
> +	radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE);
> +
> +	if (index)
> +		*index = iter.index;
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(idr_alloc_ext);

Can you express idr_alloc in terms of idr_alloc_ext? Same for most of
the other functions (it seems that signed int was used as return value
to indicate error cases, thus it should be easy to map those).

[...]

Thanks,
Hannes

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [patch net-next 1/3] idr: Add new APIs to support unsigned long
  2017-08-29  7:14   ` Hannes Frederic Sowa
@ 2017-08-29  7:34     ` Chris Mi
  2017-08-29  7:57       ` Jiri Pirko
  2017-08-29  7:56     ` Jiri Pirko
  1 sibling, 1 reply; 49+ messages in thread
From: Chris Mi @ 2017-08-29  7:34 UTC (permalink / raw)
  To: Hannes Frederic Sowa; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem, mawilcox

Hi,

> -----Original Message-----
> From: Hannes Frederic Sowa [mailto:hannes@stressinduktion.org]
> Sent: Tuesday, August 29, 2017 3:14 PM
> To: Chris Mi <chrism@mellanox.com>
> Cc: netdev@vger.kernel.org; jhs@mojatatu.com;
> xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> mawilcox@microsoft.com
> Subject: Re: [patch net-next 1/3] idr: Add new APIs to support unsigned long
> 
> Hello,
> 
> Chris Mi <chrism@mellanox.com> writes:
> 
> > The following new APIs are added:
> >
> > int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
> >                   unsigned long start, unsigned long end, gfp_t gfp);
> > static inline void *idr_remove_ext(struct idr *idr, unsigned long id);
> > static inline void *idr_find_ext(const struct idr *idr, unsigned long
> > id); void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long
> > id); void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
> >
> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> >  include/linux/idr.h        | 16 ++++++++++
> >  include/linux/radix-tree.h |  3 ++
> >  lib/idr.c                  | 56 +++++++++++++++++++++++++++++++++++
> >  lib/radix-tree.c           | 73
> ++++++++++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 148 insertions(+)
> >
> 
> [...]
> 
> > +int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
> > +		  unsigned long start, unsigned long end, gfp_t gfp) {
> > +	void __rcu **slot;
> > +	struct radix_tree_iter iter;
> > +
> > +	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
> > +		return -EINVAL;
> > +
> > +	radix_tree_iter_init(&iter, start);
> > +	slot = idr_get_free_ext(&idr->idr_rt, &iter, gfp, end);
> > +	if (IS_ERR(slot))
> > +		return PTR_ERR(slot);
> > +
> > +	radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr);
> > +	radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE);
> > +
> > +	if (index)
> > +		*index = iter.index;
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(idr_alloc_ext);
> 
> Can you express idr_alloc in terms of idr_alloc_ext? Same for most of the
> other functions (it seems that signed int was used as return value to indicate
> error cases, thus it should be easy to map those).
In idr_alloc(), we have the following check:

        if (WARN_ON_ONCE(start < 0))
                return -EINVAL;

But in idr_alloc_ext(), since we are using unsigned long, we needn't such check.

In order to reuse several lines of code, I think it is not worth to express idr_alloc()
In terms of idr_alloc_ext. 

Thanks,
Chris
> 
> [...]
> 
> Thanks,
> Hannes

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 1/3] idr: Add new APIs to support unsigned long
  2017-08-29  7:14   ` Hannes Frederic Sowa
  2017-08-29  7:34     ` Chris Mi
@ 2017-08-29  7:56     ` Jiri Pirko
  1 sibling, 0 replies; 49+ messages in thread
From: Jiri Pirko @ 2017-08-29  7:56 UTC (permalink / raw)
  To: Hannes Frederic Sowa
  Cc: Chris Mi, netdev, jhs, xiyou.wangcong, davem, mawilcox

Tue, Aug 29, 2017 at 09:14:04AM CEST, hannes@stressinduktion.org wrote:
>Hello,
>
>Chris Mi <chrism@mellanox.com> writes:
>
>> The following new APIs are added:
>>
>> int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
>>                   unsigned long start, unsigned long end, gfp_t gfp);
>> static inline void *idr_remove_ext(struct idr *idr, unsigned long id);
>> static inline void *idr_find_ext(const struct idr *idr, unsigned long id);
>> void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long id);
>> void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
>>
>> Signed-off-by: Chris Mi <chrism@mellanox.com>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>>  include/linux/idr.h        | 16 ++++++++++
>>  include/linux/radix-tree.h |  3 ++
>>  lib/idr.c                  | 56 +++++++++++++++++++++++++++++++++++
>>  lib/radix-tree.c           | 73 ++++++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 148 insertions(+)
>>
>
>[...]
>
>> +int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
>> +		  unsigned long start, unsigned long end, gfp_t gfp)
>> +{
>> +	void __rcu **slot;
>> +	struct radix_tree_iter iter;
>> +
>> +	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
>> +		return -EINVAL;
>> +
>> +	radix_tree_iter_init(&iter, start);
>> +	slot = idr_get_free_ext(&idr->idr_rt, &iter, gfp, end);
>> +	if (IS_ERR(slot))
>> +		return PTR_ERR(slot);
>> +
>> +	radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr);
>> +	radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE);
>> +
>> +	if (index)
>> +		*index = iter.index;
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(idr_alloc_ext);
>
>Can you express idr_alloc in terms of idr_alloc_ext? Same for most of
>the other functions (it seems that signed int was used as return value
>to indicate error cases, thus it should be easy to map those).

Agreed. Same for free function.


>
>[...]
>
>Thanks,
>Hannes

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 1/3] idr: Add new APIs to support unsigned long
  2017-08-29  7:34     ` Chris Mi
@ 2017-08-29  7:57       ` Jiri Pirko
  2017-08-29  8:00         ` Chris Mi
  0 siblings, 1 reply; 49+ messages in thread
From: Jiri Pirko @ 2017-08-29  7:57 UTC (permalink / raw)
  To: Chris Mi
  Cc: Hannes Frederic Sowa, netdev, jhs, xiyou.wangcong, davem, mawilcox

Tue, Aug 29, 2017 at 09:34:47AM CEST, chrism@mellanox.com wrote:
>Hi,
>
>> -----Original Message-----
>> From: Hannes Frederic Sowa [mailto:hannes@stressinduktion.org]
>> Sent: Tuesday, August 29, 2017 3:14 PM
>> To: Chris Mi <chrism@mellanox.com>
>> Cc: netdev@vger.kernel.org; jhs@mojatatu.com;
>> xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
>> mawilcox@microsoft.com
>> Subject: Re: [patch net-next 1/3] idr: Add new APIs to support unsigned long
>> 
>> Hello,
>> 
>> Chris Mi <chrism@mellanox.com> writes:
>> 
>> > The following new APIs are added:
>> >
>> > int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
>> >                   unsigned long start, unsigned long end, gfp_t gfp);
>> > static inline void *idr_remove_ext(struct idr *idr, unsigned long id);
>> > static inline void *idr_find_ext(const struct idr *idr, unsigned long
>> > id); void *idr_replace_ext(struct idr *idr, void *ptr, unsigned long
>> > id); void *idr_get_next_ext(struct idr *idr, unsigned long *nextid);
>> >
>> > Signed-off-by: Chris Mi <chrism@mellanox.com>
>> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> > ---
>> >  include/linux/idr.h        | 16 ++++++++++
>> >  include/linux/radix-tree.h |  3 ++
>> >  lib/idr.c                  | 56 +++++++++++++++++++++++++++++++++++
>> >  lib/radix-tree.c           | 73
>> ++++++++++++++++++++++++++++++++++++++++++++++
>> >  4 files changed, 148 insertions(+)
>> >
>> 
>> [...]
>> 
>> > +int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
>> > +		  unsigned long start, unsigned long end, gfp_t gfp) {
>> > +	void __rcu **slot;
>> > +	struct radix_tree_iter iter;
>> > +
>> > +	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
>> > +		return -EINVAL;
>> > +
>> > +	radix_tree_iter_init(&iter, start);
>> > +	slot = idr_get_free_ext(&idr->idr_rt, &iter, gfp, end);
>> > +	if (IS_ERR(slot))
>> > +		return PTR_ERR(slot);
>> > +
>> > +	radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr);
>> > +	radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE);
>> > +
>> > +	if (index)
>> > +		*index = iter.index;
>> > +	return 0;
>> > +}
>> > +EXPORT_SYMBOL_GPL(idr_alloc_ext);
>> 
>> Can you express idr_alloc in terms of idr_alloc_ext? Same for most of the
>> other functions (it seems that signed int was used as return value to indicate
>> error cases, thus it should be easy to map those).
>In idr_alloc(), we have the following check:
>
>        if (WARN_ON_ONCE(start < 0))
>                return -EINVAL;
>
>But in idr_alloc_ext(), since we are using unsigned long, we needn't such check.

You can just check and call idr_alloc_ext then to do the actual work.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [patch net-next 1/3] idr: Add new APIs to support unsigned long
  2017-08-29  7:57       ` Jiri Pirko
@ 2017-08-29  8:00         ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-29  8:00 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: Hannes Frederic Sowa, netdev, jhs, xiyou.wangcong, davem, mawilcox



> -----Original Message-----
> From: Jiri Pirko [mailto:jiri@resnulli.us]
> Sent: Tuesday, August 29, 2017 3:57 PM
> To: Chris Mi <chrism@mellanox.com>
> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>;
> netdev@vger.kernel.org; jhs@mojatatu.com; xiyou.wangcong@gmail.com;
> davem@davemloft.net; mawilcox@microsoft.com
> Subject: Re: [patch net-next 1/3] idr: Add new APIs to support unsigned long
> 
> Tue, Aug 29, 2017 at 09:34:47AM CEST, chrism@mellanox.com wrote:
> >Hi,
> >
> >> -----Original Message-----
> >> From: Hannes Frederic Sowa [mailto:hannes@stressinduktion.org]
> >> Sent: Tuesday, August 29, 2017 3:14 PM
> >> To: Chris Mi <chrism@mellanox.com>
> >> Cc: netdev@vger.kernel.org; jhs@mojatatu.com;
> >> xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> >> mawilcox@microsoft.com
> >> Subject: Re: [patch net-next 1/3] idr: Add new APIs to support
> >> unsigned long
> >>
> >> Hello,
> >>
> >> Chris Mi <chrism@mellanox.com> writes:
> >>
> >> > The following new APIs are added:
> >> >
> >> > int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
> >> >                   unsigned long start, unsigned long end, gfp_t
> >> > gfp); static inline void *idr_remove_ext(struct idr *idr, unsigned
> >> > long id); static inline void *idr_find_ext(const struct idr *idr,
> >> > unsigned long id); void *idr_replace_ext(struct idr *idr, void
> >> > *ptr, unsigned long id); void *idr_get_next_ext(struct idr *idr,
> >> > unsigned long *nextid);
> >> >
> >> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> >> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> >> > ---
> >> >  include/linux/idr.h        | 16 ++++++++++
> >> >  include/linux/radix-tree.h |  3 ++
> >> >  lib/idr.c                  | 56 +++++++++++++++++++++++++++++++++++
> >> >  lib/radix-tree.c           | 73
> >> ++++++++++++++++++++++++++++++++++++++++++++++
> >> >  4 files changed, 148 insertions(+)
> >> >
> >>
> >> [...]
> >>
> >> > +int idr_alloc_ext(struct idr *idr, void *ptr, unsigned long *index,
> >> > +		  unsigned long start, unsigned long end, gfp_t gfp) {
> >> > +	void __rcu **slot;
> >> > +	struct radix_tree_iter iter;
> >> > +
> >> > +	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
> >> > +		return -EINVAL;
> >> > +
> >> > +	radix_tree_iter_init(&iter, start);
> >> > +	slot = idr_get_free_ext(&idr->idr_rt, &iter, gfp, end);
> >> > +	if (IS_ERR(slot))
> >> > +		return PTR_ERR(slot);
> >> > +
> >> > +	radix_tree_iter_replace(&idr->idr_rt, &iter, slot, ptr);
> >> > +	radix_tree_iter_tag_clear(&idr->idr_rt, &iter, IDR_FREE);
> >> > +
> >> > +	if (index)
> >> > +		*index = iter.index;
> >> > +	return 0;
> >> > +}
> >> > +EXPORT_SYMBOL_GPL(idr_alloc_ext);
> >>
> >> Can you express idr_alloc in terms of idr_alloc_ext? Same for most of
> >> the other functions (it seems that signed int was used as return
> >> value to indicate error cases, thus it should be easy to map those).
> >In idr_alloc(), we have the following check:
> >
> >        if (WARN_ON_ONCE(start < 0))
> >                return -EINVAL;
> >
> >But in idr_alloc_ext(), since we are using unsigned long, we needn't such
> check.
> 
> You can just check and call idr_alloc_ext then to do the actual work.
OK, will fix it.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
  2017-08-29  3:25     ` Chris Mi
@ 2017-08-30 10:30       ` Simon Horman
  0 siblings, 0 replies; 49+ messages in thread
From: Simon Horman @ 2017-08-30 10:30 UTC (permalink / raw)
  To: Chris Mi; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem, mawilcox

On Tue, Aug 29, 2017 at 03:25:35AM +0000, Chris Mi wrote:
> 
> 
> > -----Original Message-----
> > From: Simon Horman [mailto:simon.horman@netronome.com]
> > Sent: Monday, August 28, 2017 7:37 PM
> > To: Chris Mi <chrism@mellanox.com>
> > Cc: netdev@vger.kernel.org; jhs@mojatatu.com;
> > xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net;
> > mawilcox@microsoft.com
> > Subject: Re: [patch net-next 2/3] net/sched: Change cls_flower to use IDR
> > 
> > On Mon, Aug 28, 2017 at 02:41:16AM -0400, Chris Mi wrote:
> > > Currently, all filters with the same priority are linked in a doubly
> > > linked list. Every filter should have a unique handle. To make the
> > > handle unique, we need to iterate the list every time to see if the
> > > handle exists or not when inserting a new filter. It is time-consuming.
> > > For example, it takes about 5m3.169s to insert 64K rules.
> > >
> > > This patch changes cls_flower to use IDR. With this patch, it takes
> > > about 0m1.127s to insert 64K rules. The improvement is huge.
> > 
> > Very nice :)
> > 
> > > But please note that in this testing, all filters share the same action.
> > > If every filter has a unique action, that is another bottleneck.
> > > Follow-up patch in this patchset addresses that.
> > >
> > > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> > > ---
> > >  net/sched/cls_flower.c | 55
> > > +++++++++++++++++++++-----------------------------
> > >  1 file changed, 23 insertions(+), 32 deletions(-)
> > >
> > > diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index
> > > bd9dab4..3d041d2 100644
> > > --- a/net/sched/cls_flower.c
> > > +++ b/net/sched/cls_flower.c
> > 
> > ...
> > 
> > > @@ -890,6 +870,7 @@ static int fl_change(struct net *net, struct sk_buff
> > *in_skb,
> > >  	struct cls_fl_filter *fnew;
> > >  	struct nlattr **tb;
> > >  	struct fl_flow_mask mask = {};
> > > +	unsigned long idr_index;
> > >  	int err;
> > >
> > >  	if (!tca[TCA_OPTIONS])
> > > @@ -920,13 +901,21 @@ static int fl_change(struct net *net, struct sk_buff
> > *in_skb,
> > >  		goto errout;
> > >
> > >  	if (!handle) {
> > > -		handle = fl_grab_new_handle(tp, head);
> > > -		if (!handle) {
> > > -			err = -EINVAL;
> > > +		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> > > +				    1, 0x80000000, GFP_KERNEL);
> > > +		if (err)
> > >  			goto errout;
> > > -		}
> > > +		fnew->handle = idr_index;
> > > +	}
> > > +
> > > +	/* user specifies a handle and it doesn't exist */
> > > +	if (handle && !fold) {
> > > +		err = idr_alloc_ext(&head->handle_idr, fnew, &idr_index,
> > > +				    handle, handle + 1, GFP_KERNEL);
> > > +		if (err)
> > > +			goto errout;
> > > +		fnew->handle = idr_index;
> > >  	}
> > > -	fnew->handle = handle;
> > >
> > >  	if (tb[TCA_FLOWER_FLAGS]) {
> > >  		fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
> > > @@ -980,6 +969,8 @@ static int fl_change(struct net *net, struct sk_buff
> > *in_skb,
> > >  	*arg = fnew;
> > >
> > >  	if (fold) {
> > > +		fnew->handle = handle;
> > 
> > Can it be the case that fold is non-NULL and handle is zero?
> > The handling of that case seem to have changed in this patch.
> I don't think that could happen.  In function tc_ctl_tfilter(),
> 
> fl_get() will be called.  If handle is zero, fl_get() will return NULL.
> That means fold is NULL.

Thanks for the explanation, I see that now.

> > > +		idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
> > >  		list_replace_rcu(&fold->list, &fnew->list);
> > >  		tcf_unbind_filter(tp, &fold->res);
> > >  		call_rcu(&fold->rcu, fl_destroy_filter);

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  2:12 ` Chris Mi
@ 2017-08-16 21:51   ` Frank Rowand
  -1 siblings, 0 replies; 49+ messages in thread
From: Frank Rowand @ 2017-08-16 21:51 UTC (permalink / raw)
  To: Chris Mi; +Cc: arm-soc, linux-kernel, Pantelis Antoniou, Rob Herring

I deleted most of the distribution list.  My email server rejects an email
with this many recipients.


On 08/15/17 19:12, Chris Mi wrote:
> IDR uses internally radix tree which uses unsigned long. It doesn't
> makes sense to have index as signed value.
> 
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---

< snip >

>  drivers/of/overlay.c                            | 15 +++----
>  drivers/of/unittest.c                           | 25 ++++++-----

< snip >

>  include/linux/of.h                              |  4 +-

< snip >

Split the patch apart.


> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index c0e4ee1..e5cfe01 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -373,10 +373,11 @@ static int of_free_overlay_info(struct of_overlay *ov)
>   *
>   * Returns the id of the created overlay, or a negative error number
>   */
> -int of_overlay_create(struct device_node *tree)
> +int of_overlay_create(struct device_node *tree, unsigned long *id)

Added parameter *id, but never assigned a value to it.

>  {
>  	struct of_overlay *ov;
> -	int err, id;
> +	unsigned long idr_index;
> +	int err;
>  
>  	/* allocate the overlay structure */
>  	ov = kzalloc(sizeof(*ov), GFP_KERNEL);
> @@ -390,12 +391,10 @@ int of_overlay_create(struct device_node *tree)
>  
>  	mutex_lock(&of_mutex);
>  
> -	id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL);
> -	if (id < 0) {
> -		err = id;
> +	err = idr_alloc(&ov_idr, ov, &idr_index, 0, 0, GFP_KERNEL);
> +	if (err)
>  		goto err_destroy_trans;
> -	}
> -	ov->id = id;
> +	ov->id = idr_index;
>  
>  	/* build the overlay info structures */
>  	err = of_build_overlay_info(ov, tree);
> @@ -430,7 +429,7 @@ int of_overlay_create(struct device_node *tree)
>  
>  	mutex_unlock(&of_mutex);
>  
> -	return id;
> +	return err;
>  
>  err_revert_overlay:
>  err_abort_trans:
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index 0107fc6..ac7cc76 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -1242,7 +1242,8 @@ static int of_unittest_apply_overlay(int overlay_nr, int unittest_nr,
>  		int *overlay_id)
>  {
>  	struct device_node *np = NULL;
> -	int ret, id = -1;
> +	unsigned long id = -1;

Assigns a negative value to an unsigned.


> +	int ret;
>  
>  	np = of_find_node_by_path(overlay_path(overlay_nr));
>  	if (np == NULL) {
> @@ -1252,17 +1253,14 @@ static int of_unittest_apply_overlay(int overlay_nr, int unittest_nr,
>  		goto out;
>  	}
>  
> -	ret = of_overlay_create(np);
> -	if (ret < 0) {
> +	ret = of_overlay_create(np, &id);
> +	if (ret) {
>  		unittest(0, "could not create overlay from \"%s\"\n",
>  				overlay_path(overlay_nr));
>  		goto out;
>  	}
> -	id = ret;
>  	of_unittest_track_overlay(id);
>  
> -	ret = 0;
> -
>  out:
>  	of_node_put(np);
>  
> @@ -1442,6 +1440,7 @@ static void of_unittest_overlay_6(void)
>  	int ret, i, ov_id[2];
>  	int overlay_nr = 6, unittest_nr = 6;
>  	int before = 0, after = 1;
> +	unsigned long id;
>  
>  	/* unittest device must be in before state */
>  	for (i = 0; i < 2; i++) {
> @@ -1466,13 +1465,13 @@ static void of_unittest_overlay_6(void)
>  			return;
>  		}
>  
> -		ret = of_overlay_create(np);
> -		if (ret < 0)  {
> +		ret = of_overlay_create(np, &id);
> +		if (ret)  {
>  			unittest(0, "could not create overlay from \"%s\"\n",
>  					overlay_path(overlay_nr + i));
>  			return;
>  		}
> -		ov_id[i] = ret;
> +		ov_id[i] = id;
>  		of_unittest_track_overlay(ov_id[i]);
>  	}
>  
> @@ -2094,6 +2093,7 @@ static int __init overlay_data_add(int onum)
>  	int ret;
>  	u32 size;
>  	u32 size_from_header;
> +	unsigned long id;
>  
>  	for (k = 0, info = overlays; info; info++, k++) {
>  		if (k == onum)
> @@ -2138,13 +2138,12 @@ static int __init overlay_data_add(int onum)
>  		goto out_free_np_overlay;
>  	}
>  
> -	ret = of_overlay_create(info->np_overlay);
> -	if (ret < 0) {
> +	ret = of_overlay_create(info->np_overlay, &id);
> +	if (ret) {
>  		pr_err("of_overlay_create() (ret=%d), %d\n", ret, onum);
>  		goto out_free_np_overlay;
>  	} else {
> -		info->overlay_id = ret;
> -		ret = 0;
> +		info->overlay_id = id;
>  	}
>  
>  	pr_debug("__dtb_overlay_begin applied, overlay id %d\n", ret);



> diff --git a/include/linux/of.h b/include/linux/of.h
> index 4a8a709..ceb14bf 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -1307,7 +1307,7 @@ struct of_overlay_notify_data {
>  #ifdef CONFIG_OF_OVERLAY
>  
>  /* ID based overlays; the API for external users */
> -int of_overlay_create(struct device_node *tree);
> +int of_overlay_create(struct device_node *tree, *unsigned long *id);

*unsigned long *id should be: unsigned long *id

How did you test this patch?


>  int of_overlay_destroy(int id);
>  int of_overlay_destroy_all(void);
>  
> @@ -1316,7 +1316,7 @@ struct of_overlay_notify_data {
>  
>  #else
>  
> -static inline int of_overlay_create(struct device_node *tree)
> +static inline int of_overlay_create(struct device_node *tree, unsigned long *id)
>  {
>  	return -ENOTSUPP;
>  }

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16 21:51   ` Frank Rowand
  0 siblings, 0 replies; 49+ messages in thread
From: Frank Rowand @ 2017-08-16 21:51 UTC (permalink / raw)
  To: linux-arm-kernel

I deleted most of the distribution list.  My email server rejects an email
with this many recipients.


On 08/15/17 19:12, Chris Mi wrote:
> IDR uses internally radix tree which uses unsigned long. It doesn't
> makes sense to have index as signed value.
> 
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---

< snip >

>  drivers/of/overlay.c                            | 15 +++----
>  drivers/of/unittest.c                           | 25 ++++++-----

< snip >

>  include/linux/of.h                              |  4 +-

< snip >

Split the patch apart.


> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index c0e4ee1..e5cfe01 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -373,10 +373,11 @@ static int of_free_overlay_info(struct of_overlay *ov)
>   *
>   * Returns the id of the created overlay, or a negative error number
>   */
> -int of_overlay_create(struct device_node *tree)
> +int of_overlay_create(struct device_node *tree, unsigned long *id)

Added parameter *id, but never assigned a value to it.

>  {
>  	struct of_overlay *ov;
> -	int err, id;
> +	unsigned long idr_index;
> +	int err;
>  
>  	/* allocate the overlay structure */
>  	ov = kzalloc(sizeof(*ov), GFP_KERNEL);
> @@ -390,12 +391,10 @@ int of_overlay_create(struct device_node *tree)
>  
>  	mutex_lock(&of_mutex);
>  
> -	id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL);
> -	if (id < 0) {
> -		err = id;
> +	err = idr_alloc(&ov_idr, ov, &idr_index, 0, 0, GFP_KERNEL);
> +	if (err)
>  		goto err_destroy_trans;
> -	}
> -	ov->id = id;
> +	ov->id = idr_index;
>  
>  	/* build the overlay info structures */
>  	err = of_build_overlay_info(ov, tree);
> @@ -430,7 +429,7 @@ int of_overlay_create(struct device_node *tree)
>  
>  	mutex_unlock(&of_mutex);
>  
> -	return id;
> +	return err;
>  
>  err_revert_overlay:
>  err_abort_trans:
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index 0107fc6..ac7cc76 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -1242,7 +1242,8 @@ static int of_unittest_apply_overlay(int overlay_nr, int unittest_nr,
>  		int *overlay_id)
>  {
>  	struct device_node *np = NULL;
> -	int ret, id = -1;
> +	unsigned long id = -1;

Assigns a negative value to an unsigned.


> +	int ret;
>  
>  	np = of_find_node_by_path(overlay_path(overlay_nr));
>  	if (np == NULL) {
> @@ -1252,17 +1253,14 @@ static int of_unittest_apply_overlay(int overlay_nr, int unittest_nr,
>  		goto out;
>  	}
>  
> -	ret = of_overlay_create(np);
> -	if (ret < 0) {
> +	ret = of_overlay_create(np, &id);
> +	if (ret) {
>  		unittest(0, "could not create overlay from \"%s\"\n",
>  				overlay_path(overlay_nr));
>  		goto out;
>  	}
> -	id = ret;
>  	of_unittest_track_overlay(id);
>  
> -	ret = 0;
> -
>  out:
>  	of_node_put(np);
>  
> @@ -1442,6 +1440,7 @@ static void of_unittest_overlay_6(void)
>  	int ret, i, ov_id[2];
>  	int overlay_nr = 6, unittest_nr = 6;
>  	int before = 0, after = 1;
> +	unsigned long id;
>  
>  	/* unittest device must be in before state */
>  	for (i = 0; i < 2; i++) {
> @@ -1466,13 +1465,13 @@ static void of_unittest_overlay_6(void)
>  			return;
>  		}
>  
> -		ret = of_overlay_create(np);
> -		if (ret < 0)  {
> +		ret = of_overlay_create(np, &id);
> +		if (ret)  {
>  			unittest(0, "could not create overlay from \"%s\"\n",
>  					overlay_path(overlay_nr + i));
>  			return;
>  		}
> -		ov_id[i] = ret;
> +		ov_id[i] = id;
>  		of_unittest_track_overlay(ov_id[i]);
>  	}
>  
> @@ -2094,6 +2093,7 @@ static int __init overlay_data_add(int onum)
>  	int ret;
>  	u32 size;
>  	u32 size_from_header;
> +	unsigned long id;
>  
>  	for (k = 0, info = overlays; info; info++, k++) {
>  		if (k == onum)
> @@ -2138,13 +2138,12 @@ static int __init overlay_data_add(int onum)
>  		goto out_free_np_overlay;
>  	}
>  
> -	ret = of_overlay_create(info->np_overlay);
> -	if (ret < 0) {
> +	ret = of_overlay_create(info->np_overlay, &id);
> +	if (ret) {
>  		pr_err("of_overlay_create() (ret=%d), %d\n", ret, onum);
>  		goto out_free_np_overlay;
>  	} else {
> -		info->overlay_id = ret;
> -		ret = 0;
> +		info->overlay_id = id;
>  	}
>  
>  	pr_debug("__dtb_overlay_begin applied, overlay id %d\n", ret);



> diff --git a/include/linux/of.h b/include/linux/of.h
> index 4a8a709..ceb14bf 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -1307,7 +1307,7 @@ struct of_overlay_notify_data {
>  #ifdef CONFIG_OF_OVERLAY
>  
>  /* ID based overlays; the API for external users */
> -int of_overlay_create(struct device_node *tree);
> +int of_overlay_create(struct device_node *tree, *unsigned long *id);

*unsigned long *id should be: unsigned long *id

How did you test this patch?


>  int of_overlay_destroy(int id);
>  int of_overlay_destroy_all(void);
>  
> @@ -1316,7 +1316,7 @@ struct of_overlay_notify_data {
>  
>  #else
>  
> -static inline int of_overlay_create(struct device_node *tree)
> +static inline int of_overlay_create(struct device_node *tree, unsigned long *id)
>  {
>  	return -ENOTSUPP;
>  }

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  8:31     ` Christian König
  2017-08-16  8:39       ` Jiri Pirko
@ 2017-08-16 14:28       ` David Laight
  1 sibling, 0 replies; 49+ messages in thread
From: David Laight @ 2017-08-16 14:28 UTC (permalink / raw)
  To: 'Christian König', Jiri Pirko; +Cc: Chris Mi, netdev

From: Christian König
> Sent: 16 August 2017 09:32
> Am 16.08.2017 um 10:16 schrieb Jiri Pirko:
> > Wed, Aug 16, 2017 at 09:49:07AM CEST, christian.koenig@amd.com wrote:
> >> Am 16.08.2017 um 04:12 schrieb Chris Mi:
...
> >>> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> >>> -	if (ret < 0) {
> >>> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> >>> +			GFP_KERNEL);
> >>> +	if (ret) {
> >>>    		if (ret == -ENOSPC) {
> >>>    			printk(KERN_ERR "bsg: too many bsg devices\n");
> >>>    			ret = -EINVAL;
> >> The condition "if (ret)" will now always be true after the first allocation
> >> and so we always run into the error handling after that.
> > On success, idr_alloc returns 0.
> 
> Ah, I see. You change the idr_alloc to return the resulting index as
> separate parameter.

Returning values by reference typically generates considerably worse code
that using the function return value.
It isn't just the extra parameter, it can constrain the generated code
in other ways.
That is why ERR_PTR() and friends exist.
IMHO You need a really good reason to make this change.

	David



^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  9:31           ` Jiri Pirko
@ 2017-08-16  9:41             ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  9:41 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Chris Mi, netdev

Am 16.08.2017 um 11:31 schrieb Jiri Pirko:
> [SNIP]
> I don't. It is an API change, maintainers of the individual drivers are
> not expected to review the patches like this.

Yeah, completely agree.

>> If yes then it somehow makes sense to send the patch bit by bit, if no then
>> it doesn't seem to make to much sense to CC them all individually.
>>
>>>>>> I've never read the bsg code before, but that's certainly not correct. And
>>>>>> that incorrect pattern repeats over and over again in this code.
>>>>>>
>>>>>> Apart from that why the heck do you want to allocate more than 1<<31 handles?
>>>>> tc action indexes for example. That is part of this patchset.
>>>> Well, let me refine the question: Why does tc action indexes need more than
>>>> 31 bits? From an outside view that looks like pure overkill.
>>> That is current state, uapi. We have to live with it.
>> Is the range to allocate from part of the uapi or what is the issue here?
> Yes.

A bit strange uapi design, but ok in this case that change actually 
makes sense.

>> If the issue is that userspace can specify the handle then I suggest that you
>> use the radix tree directly instead of the idr wrapper around it.
> But why? idr is exactly the tool we need. Only signed int does not suit
> us. In fact, it does not make sense idr is using signed int when it
> uses radix tree with unsigned long under the hood.

Well it always depends on what you do and how to use it.

In amdgpu for example for have very very short lived objects and only 
few of them are active at the same time.

The solution was not to use and idr, but rather 64bit identifiers and a 
ring buffer with the last 128 entries.

But in your case changing the idr calling convention actually makes 
sense (at least from the tn mile high view), feel free to add an 
Acked-by: Christian König <christian.koenig@amd.com> on it.

Regards,
Christian.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  8:55         ` Christian König
@ 2017-08-16  9:31           ` Jiri Pirko
  2017-08-16  9:41             ` Christian König
  0 siblings, 1 reply; 49+ messages in thread
From: Jiri Pirko @ 2017-08-16  9:31 UTC (permalink / raw)
  To: Christian König; +Cc: Chris Mi, netdev

Wed, Aug 16, 2017 at 10:55:56AM CEST, christian.koenig@amd.com wrote:
>Am 16.08.2017 um 10:39 schrieb Jiri Pirko:
>> Wed, Aug 16, 2017 at 10:31:35AM CEST, christian.koenig@amd.com wrote:
>> > Am 16.08.2017 um 10:16 schrieb Jiri Pirko:
>> > > Wed, Aug 16, 2017 at 09:49:07AM CEST, christian.koenig@amd.com wrote:
>> > > > Am 16.08.2017 um 04:12 schrieb Chris Mi:
>> > > > > Using current TC code, it is very slow to insert a lot of rules.
>> > > > > 
>> > > > > In order to improve the rules update rate in TC,
>> > > > > we introduced the following two changes:
>> > > > >            1) changed cls_flower to use IDR to manage the filters.
>> > > > >            2) changed all act_xxx modules to use IDR instead of
>> > > > >               a small hash table
>> > > > > 
>> > > > > But IDR has a limitation that it uses int. TC handle uses u32.
>> > > > > To make sure there is no regression, we also changed IDR to use
>> > > > > unsigned long. All clients of IDR are changed to use new IDR API.
>> > > > WOW, wait a second. The idr change is touching a lot of drivers and to be
>> > > > honest doesn't looks correct at all.
>> > > > 
>> > > > Just look at the first chunk of your modification:
>> > > > > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>> > > > >     	mutex_lock(&bsg_mutex);
>> > > > > -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
>> > > > > -	if (ret < 0) {
>> > > > > +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
>> > > > > +			GFP_KERNEL);
>> > > > > +	if (ret) {
>> > > > >     		if (ret == -ENOSPC) {
>> > > > >     			printk(KERN_ERR "bsg: too many bsg devices\n");
>> > > > >     			ret = -EINVAL;
>> > > > The condition "if (ret)" will now always be true after the first allocation
>> > > > and so we always run into the error handling after that.
>> > > On success, idr_alloc returns 0.
>> > Ah, I see. You change the idr_alloc to return the resulting index as separate
>> > parameter.
>> > 
>> > You should explicit note that in the commit message, cause that is something
>> > easily overlooked.
>> > 
>> > In general I strongly suggest to add a separate interface for allocating
>> > unsigned long handles, use that for the while being and then move the
>> > existing drivers over bit by bit.
>> > 
>> > A single patch which touches so many different driver is practically
>> > impossible to review consequently.
>> Understood. I think is is good to avoid having some "idr_alloc2". That
>> is why I suggested to do this in one go, to avoid "idr_alloc2" and then
>> patch to rename "idr_alloc2" to "idr_alloc" once nobody uses the original
>> "idr_alloc". In fact, if you do it driver, by driver, the review burden
>> would be the same, probably even bigger, you'll just have 100+ patches.
>> Why would it help?
>
>Because it would give each maintainer only the part of the change he is
>interested in.
>
>Current status of this change is that you send a mail with nearly 300 people
>on CC.

That was a mistake to cc all.


>
>Do you really expect to get an reviewed-by or acked-by on this single patch
>from all of them?

I don't. It is an API change, maintainers of the individual drivers are
not expected to review the patches like this.


>
>If yes then it somehow makes sense to send the patch bit by bit, if no then
>it doesn't seem to make to much sense to CC them all individually.
>
>> > > > I've never read the bsg code before, but that's certainly not correct. And
>> > > > that incorrect pattern repeats over and over again in this code.
>> > > > 
>> > > > Apart from that why the heck do you want to allocate more than 1<<31 handles?
>> > > tc action indexes for example. That is part of this patchset.
>> > Well, let me refine the question: Why does tc action indexes need more than
>> > 31 bits? From an outside view that looks like pure overkill.
>> That is current state, uapi. We have to live with it.
>
>Is the range to allocate from part of the uapi or what is the issue here?

Yes.

>
>If the issue is that userspace can specify the handle then I suggest that you
>use the radix tree directly instead of the idr wrapper around it.

But why? idr is exactly the tool we need. Only signed int does not suit
us. In fact, it does not make sense idr is using signed int when it
uses radix tree with unsigned long under the hood.



>
>Regards,
>Christian.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  7:49   ` Christian König
                       ` (3 preceding siblings ...)
  (?)
@ 2017-08-16  9:19     ` Chris Wilson
  -1 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: aditr, stern, agk, alexander.shishkin, alexandre.bounine,
	alexander.deucher, oakad, ast, elder, adobriyan, alex.williamson,
	AlexBin.Xie, viro, amd-gfx, amitkarwar, andresx7,
	andrew.donnellan, afd, akpm, anil.gurumurthy, anna.schumaker,
	acme, arnd, dedekind1, ashutosh.dixit, ath10k, Bart.VanAssche,
	bhaktipriya96, bjorn.andersson, boris.brezillon,
	computersforpeace, bryan.thompson, cgroups, 3chas3, ccaulfie,
	david1.zhou, cluster-devel, colin.king, xiyou.wangcong,
	cyrille.pitchen, daniel, daniel.vetter,
	dasaratharaman.chandramouli, airlied, dsa, airlied, david.binder,
	dhowells, david.kershner, dtwlin, dave, davem, teigland,
	dwindsor, dwmw2, dennis.dalessandro, devel, devesh.sharma,
	devicetree, dick.kennedy, dm-devel, don.hiatt, dgilbert,
	dledford, drbd-dev, dri-devel, elena.reshetova, edumazet, eparis,
	ericvh, ebiederm, evan.quan, felipe.balbi, Felix.Kuehling,
	f.fainelli, fw, frowand.list, fbarrat, fujita.tomonori, gbhat,
	geliangtang, kraxel, gregkh, greybus-dev, linux, gustavo.padovan,
	hal.rosenstock, hannes, hare, ishkamiel, hans.westgaard.ry,
	ray.huang, mingo, inki.dae, intel-gfx, intel-gvt-dev, iommu,
	ira.weiny, jinpu.wang, jhs, jejb, james.smart, jani.nikula, jack,
	jarkko.sakkinen, jarno, Jason, jgunthorpe, jasowang, javier,
	bfields, jlayton, axboe, jens.wiklander, jiangyilism, jiri, jiri,
	jlbec, joro, johan, johannes, hannes, john, jonathanh, jon.maloy,
	joonas.lahtinen, jy0922.shim, jbacik, Jerry.Zhang, jsarha,
	Kai.Makisara, kvalo, keescook, krzk, kgene, kvm, kyungmin.park,
	jiangshanlai, lars.ellenberg, lucho, lee.jones, leo.liu, leon,
	linux1394-devel, linux-arm-kernel, linux-atm-general,
	linux-block, linux-i2c, linux-kernel, linux-mm, linux-mtd,
	linux-nfs, linux-pm, linuxppc-dev, linux-ppp, linux-raid,
	linux-rdma, linux-remoteproc, linux-samsung-soc, linux-scsi,
	linux-sctp, linux-tegra, linux-usb, linux-wireless, logang, majd,
	manfred, tpmdd, marcos.souza.org, marek.vasut, mario.kleiner.de,
	markb, mfasheh, elfring, martin.petersen, matan, mawilcox,
	mporter, mchehab, maximlevitsky, mst, mhocko, michel.daenzer,
	mike.marciniszyn, rppt, snitzer, mszeredi, minchan, tom.leiming,
	monis, Monk.Liu, nbd-general, neilb, nhorman, nab,
	nicolai.haehnle, nicolas.dichtel, niranjana.vishwanathapura,
	nishants, ngupta, ocfs2-devel, ohad, oneukum, osandov, ogerlitz,
	pali.rohar, pantelis.antoniou, paulus, paul, peterhuewe, peterz,
	pmladek, philipp.reisner, pshelar, rjw, richard, rlove, robh+dt,
	giometti, rogerq, roman.kapl, rminnich, rmk+kernel,
	sainath.grandhi, sameer.wadgaonkar, sean.hefty, seanpaul,
	bigeasy, sre, nsekhar, selvin.xavier, sergey.senozhatsky.work,
	sw0312.kim, p.shailesh, shli, shaun.tancheff, syeh,
	sparmaintainer, stefanr, sboyd, stephen, swise,
	sudarsana.kalluru, sudeep.dutt, sumit.semwal, target-devel, tj,
	thierry.reding, thellstrom, timothy.sell, tipc-discussion,
	tomas.winkler, tomi.valkeinen, tpmdd-devel, trond.myklebust,
	v9fs-developer, varun, virtualization, vdavydov.dev, vyasevich,
	linux-graphics-maintainer, longman, weiyj.lk, wsa, huxm,
	ying.xue, yishaih, yuval.shaia, lizefan, zhenyuw, zhi.a.wang

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  9:19     ` Chris Wilson
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  7:49   ` Christian König
                     ` (3 preceding siblings ...)
  (?)
@ 2017-08-16  9:19   ` Chris Wilson
  -1 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp, paulus,
	jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie, david1.zhou,
	linux-samsung-soc, maximlevitsky, sudarsana.kalluru, marek.vasut,
	linux-atm-general, dtwlin, michel.daenzer, dledford, tpmdd-devel,
	stern, longman, niranjana.vishwanathapura, philipp.reisner, shli,
	linux, ohad, pmladek, dick.kennedy, linux-pm, ericv

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  7:49   ` Christian König
                     ` (6 preceding siblings ...)
  (?)
@ 2017-08-16  9:19   ` Chris Wilson
  -1 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp, paulus,
	jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie, david1.zhou,
	linux-samsung-soc, maximlevitsky, sudarsana.kalluru, marek.vasut,
	linux-atm-general, dtwlin, michel.daenzer, dledford, tpmdd-devel,
	stern, longman, niranjana.vishwanathapura, philipp.reisner, shli,
	linux, ohad, pmladek, dick.kennedy, linux-pm, ericvh

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mailing list linux1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-devel

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  7:49   ` Christian König
                     ` (4 preceding siblings ...)
  (?)
@ 2017-08-16  9:19   ` Chris Wilson
  -1 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  9:19     ` Chris Wilson
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: aditr, stern, agk, alexander.shishkin, alexandre.bounine,
	alexander.deucher, oakad, ast, elder, adobriyan, alex.williamson,
	AlexBin.Xie, viro, amd-gfx, amitkarwar, andresx7,
	andrew.donnellan, afd, akpm, anil.gurumurthy, anna.schumaker,
	acme, arnd, dedekind1, ashutosh.dixit, ath10k, Bart.VanAssche,
	bhaktipriya96, bjorn.andersson, boris.brezillon,
	computersforpeace, bryan.thompson, cgroups, 3chas3, ccaulfie,
	david1.zhou, cluster-devel, colin.king, xiyou.wangcong,
	cyrille.pitchen, daniel, daniel.vetter,
	dasaratharaman.chandramouli, airlied, dsa, airlied, david.binder,
	dhowells, david.kershner, dtwlin, dave, davem, teigland,
	dwindsor, dwmw2, dennis.dalessandro, devel, devesh.sharma,
	devicetree, dick.kennedy, dm-devel, don.hiatt, dgilbert,
	dledford, drbd-dev, dri-devel, elena.reshetova, edumazet, eparis,
	ericvh, ebiederm, evan.quan, felipe.balbi, Felix.Kuehling,
	f.fainelli, fw, frowand.list, fbarrat, fujita.tomonori, gbhat,
	geliangtang, kraxel, gregkh, greybus-dev, linux, gustavo.padovan,
	hal.rosenstock, hannes, hare, ishkamiel, hans.westgaard.ry,
	ray.huang, mingo, inki.dae, intel-gfx, intel-gvt-dev, iommu,
	ira.weiny, jinpu.wang, jhs, jejb, james.smart, jani.nikula, jack,
	jarkko.sakkinen, jarno, Jason, jgunthorpe, jasowang, javier,
	bfields, jlayton, axboe, jens.wiklander, jiangyilism, jiri, jiri,
	jlbec, joro, johan, johannes, hannes, john, jonathanh, jon.maloy,
	joonas.lahtinen, jy0922.shim, jbacik, Jerry.Zhang, jsarha,
	Kai.Makisara, kvalo, keescook, krzk, kgene, kvm, kyungmin.park,
	jiangshanlai, lars.ellenberg, lucho, lee.jones, leo.liu, leon,
	linux1394-devel, linux-arm-kernel, linux-atm-general,
	linux-block, linux-i2c, linux-kernel, linux-mm, linux-mtd,
	linux-nfs, linux-pm, linuxppc-dev, linux-ppp, linux-raid,
	linux-rdma, linux-remoteproc, linux-samsung-soc, linux-scsi,
	linux-sctp, linux-tegra, linux-usb, linux-wireless, logang, majd,
	manfred, tpmdd, marcos.souza.org, marek.vasut, mario.kleiner.de,
	markb, mfasheh, elfring, martin.petersen, matan, mawilcox,
	mporter, mchehab, maximlevitsky, mst, mhocko, michel.daenzer,
	mike.marciniszyn, rppt, snitzer, mszeredi, minchan, tom.leiming,
	monis, Monk.Liu, nbd-general, neilb, nhorman, nab,
	nicolai.haehnle, nicolas.dichtel, niranjana.vishwanathapura,
	nishants, ngupta, ocfs2-devel, ohad, oneukum, osandov, ogerlitz,
	pali.rohar, pantelis.antoniou, paulus, paul, peterhuewe, peterz,
	pmladek, philipp.reisner, pshelar, rjw, richard, rlove, robh+dt,
	giometti, rogerq, roman.kapl, rminnich, rmk+kernel,
	sainath.grandhi, sameer.wadgaonkar, sean.hefty, seanpaul,
	bigeasy, sre, nsekhar, selvin.xavier, sergey.senozhatsky.work,
	sw0312.kim, p.shailesh, shli, shaun.tancheff, syeh,
	sparmaintainer, stefanr, sboyd, stephen, swise,
	sudarsana.kalluru, sudeep.dutt, sumit.semwal, target-devel, tj,
	thierry.reding, thellstrom, timothy.sell, tipc-discussion,
	tomas.winkler, tomi.valkeinen, tpmdd-devel, trond.myklebust,
	v9fs-developer, varun, virtualization, vdavydov.dev, vyasevich,
	linux-graphics-maintainer, longman, weiyj.lk, wsa, huxm,
	ying.xue, yishaih, yuval.shaia, lizefan, zhenyuw, zhi.a.wang

Quoting Christian K=C3=B6nig (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> =

> WOW, wait a second. The idr change is touching a lot of drivers and to =

> be honest doesn't looks correct at all.
> =

> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, str=
uct device *parent,
> >   =

> >       mutex_lock(&bsg_mutex);
> >   =

> > -     ret =3D idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNE=
L);
> > -     if (ret < 0) {
> > +     ret =3D idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEV=
S,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret =3D=3D -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret =3D -EINVAL;
> The condition "if (ret)" will now always be true after the first =

> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. =

> And that incorrect pattern repeats over and over again in this code.
> =

> Apart from that why the heck do you want to allocate more than 1<<31 =

> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=3D0 with end=3DINT_MAX
to maintain existing behaviour.
-Chris

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  9:19     ` Chris Wilson
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy, linux-

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  9:19     ` Chris Wilson
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy,
	linux-pm, ericvh, geliangtang, sparmaintainer, giometti, acme,
	inki.dae, alex.williamson, rppt, teigland, viro, ishkamiel,
	weiyj.lk, marcos.souza.org, mike.marciniszyn, elder, nbd-general,
	nhorman, nicolai.haehnle, david.binder, gregkh, linux-usb,
	anil.gurumurthy, linux-kernel, varun, majd, devesh.sharma,
	sameer.wadgaonkar, bhaktipriya96, alexander.deucher,
	shaun.tancheff, akpm, matan, jlbec, kraxel, Jason, timothy.sell,
	airlied, linux-wireless, pantelis.antoniou, sudeep.dutt, neilb,
	edumazet, target-devel, linux-i2c, daniel.vetter, jsarha,
	osandov, agk, drbd-dev, boris.brezillon, thellstrom, dave, paul,
	leon, sainath.grandhi, gustavo.padovan, james.smart, jonathanh,
	selvin.xavier, kgene, linux-graphics-maintainer, andresx7,
	3chas3, airlied, sean.hefty, virtualization, hal.rosenstock, tj,
	mszeredi, hannes, felipe.balbi, pali.rohar, tpmdd, linuxppc-dev,
	jani.nikula, greybus-dev, nishants, swise, yuval.shaia,
	xiyou.wangcong, evan.quan, lars.ellenberg, linux-arm-kernel,
	dwindsor, linux-raid, syeh, bryan.thompson, Felix.Kuehling,
	oneukum, fw, anna.schumaker, minchan, kyungmin.park, monis,
	ebiederm, sre, don.hiatt, leo.liu, jens.wiklander,
	hans.westgaard.ry, alexander.shishkin, dennis.dalessandro,
	jasowang, joonas.lahtinen, jiangshanlai, ast, fbarrat, mhocko,
	alexandre.bounine, linux-mtd, amd-gfx, cgroups, jlayton,
	frowand.list, elena.reshetova, f.fainelli, jejb, daniel,
	linux-rdma, p.shailesh, ath10k, jgunthorpe, ccaulfie,
	tomi.valkeinen, Monk.Liu, dgilbert, ira.weiny, david.kershner,
	adobriyan, jon.maloy, keescook, arnd, intel-gfx, jhs, zhenyuw,
	v9fs-developer, rmk+kernel, seanpaul, nab, Jerry.Zhang, eparis,
	nicolas.dichtel, Kai.Makisara, mporter, rogerq, linux-nfs,
	martin.petersen, linux-ppp, dm-devel, sw0312.kim,
	fujita.tomonori, iommu, roman.kapl, ngupta, andrew.donnellan,
	cyrille.pitchen, ying.xue, colin.king, computersforpeace, logang,
	davem, ocfs2-devel, rlove, jack, kvm, mst, peterz, bigeasy,
	trond.myklebust, linux-remoteproc, amitkarwar, bjorn.andersson,
	dhowells, linux-mm, ray.huang, jiri, peterhuewe, linux1394-devel,
	lee.jones, john, devel, stephen, mario.kleiner.de, manfred,
	oakad, linux-scsi, mawilcox, mfasheh, richard, joro, jiangyilism,
	elfring, cluster-devel, javier, jarkko.sakkinen, mingo,
	vdavydov.dev, kvalo, tipc-discussion, ogerlitz, devicetree,
	lizefan, huxm, mchehab, johan, aditr, linux-block, robh+dt,
	thierry.reding, hare, rminnich, linux-tegra, dsa, intel-gvt-dev,
	jy0922.shim, axboe, gbhat, tomas.winkler, dedekind1, jbacik,
	jarno, vyasevich, krzk, sboyd, jiri, afd, ashutosh.dixit,
	yishaih, rjw, hannes, Bart.VanAssche, johannes, dwmw2,
	dasaratharaman.chandramouli

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  9:19     ` Chris Wilson
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Wilson @ 2017-08-16  9:19 UTC (permalink / raw)
  To: Christian König, Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy, linux-

Quoting Christian König (2017-08-16 08:49:07)
> Am 16.08.2017 um 04:12 schrieb Chris Mi:
> > Using current TC code, it is very slow to insert a lot of rules.
> >
> > In order to improve the rules update rate in TC,
> > we introduced the following two changes:
> >          1) changed cls_flower to use IDR to manage the filters.
> >          2) changed all act_xxx modules to use IDR instead of
> >             a small hash table
> >
> > But IDR has a limitation that it uses int. TC handle uses u32.
> > To make sure there is no regression, we also changed IDR to use
> > unsigned long. All clients of IDR are changed to use new IDR API.
> 
> WOW, wait a second. The idr change is touching a lot of drivers and to 
> be honest doesn't looks correct at all.
> 
> Just look at the first chunk of your modification:
> > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
> >   
> >       mutex_lock(&bsg_mutex);
> >   
> > -     ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> > -     if (ret < 0) {
> > +     ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> > +                     GFP_KERNEL);
> > +     if (ret) {
> >               if (ret == -ENOSPC) {
> >                       printk(KERN_ERR "bsg: too many bsg devices\n");
> >                       ret = -EINVAL;
> The condition "if (ret)" will now always be true after the first 
> allocation and so we always run into the error handling after that.

ret is now purely the error code, so it doesn't look that suspicious.

> I've never read the bsg code before, but that's certainly not correct. 
> And that incorrect pattern repeats over and over again in this code.
> 
> Apart from that why the heck do you want to allocate more than 1<<31 
> handles?

And more to the point, arbitrarily changing the maximum to ULONG_MAX
where the ABI only supports U32_MAX is dangerous. Unless you do the
analysis otherwise, you have to replace all the end=0 with end=INT_MAX
to maintain existing behaviour.
-Chris

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  8:39       ` Jiri Pirko
@ 2017-08-16  8:55         ` Christian König
  2017-08-16  9:31           ` Jiri Pirko
  0 siblings, 1 reply; 49+ messages in thread
From: Christian König @ 2017-08-16  8:55 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Chris Mi, netdev

Am 16.08.2017 um 10:39 schrieb Jiri Pirko:
> Wed, Aug 16, 2017 at 10:31:35AM CEST, christian.koenig@amd.com wrote:
>> Am 16.08.2017 um 10:16 schrieb Jiri Pirko:
>>> Wed, Aug 16, 2017 at 09:49:07AM CEST, christian.koenig@amd.com wrote:
>>>> Am 16.08.2017 um 04:12 schrieb Chris Mi:
>>>>> Using current TC code, it is very slow to insert a lot of rules.
>>>>>
>>>>> In order to improve the rules update rate in TC,
>>>>> we introduced the following two changes:
>>>>>            1) changed cls_flower to use IDR to manage the filters.
>>>>>            2) changed all act_xxx modules to use IDR instead of
>>>>>               a small hash table
>>>>>
>>>>> But IDR has a limitation that it uses int. TC handle uses u32.
>>>>> To make sure there is no regression, we also changed IDR to use
>>>>> unsigned long. All clients of IDR are changed to use new IDR API.
>>>> WOW, wait a second. The idr change is touching a lot of drivers and to be
>>>> honest doesn't looks correct at all.
>>>>
>>>> Just look at the first chunk of your modification:
>>>>> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>>>>>     	mutex_lock(&bsg_mutex);
>>>>> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
>>>>> -	if (ret < 0) {
>>>>> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
>>>>> +			GFP_KERNEL);
>>>>> +	if (ret) {
>>>>>     		if (ret == -ENOSPC) {
>>>>>     			printk(KERN_ERR "bsg: too many bsg devices\n");
>>>>>     			ret = -EINVAL;
>>>> The condition "if (ret)" will now always be true after the first allocation
>>>> and so we always run into the error handling after that.
>>> On success, idr_alloc returns 0.
>> Ah, I see. You change the idr_alloc to return the resulting index as separate
>> parameter.
>>
>> You should explicit note that in the commit message, cause that is something
>> easily overlooked.
>>
>> In general I strongly suggest to add a separate interface for allocating
>> unsigned long handles, use that for the while being and then move the
>> existing drivers over bit by bit.
>>
>> A single patch which touches so many different driver is practically
>> impossible to review consequently.
> Understood. I think is is good to avoid having some "idr_alloc2". That
> is why I suggested to do this in one go, to avoid "idr_alloc2" and then
> patch to rename "idr_alloc2" to "idr_alloc" once nobody uses the original
> "idr_alloc". In fact, if you do it driver, by driver, the review burden
> would be the same, probably even bigger, you'll just have 100+ patches.
> Why would it help?

Because it would give each maintainer only the part of the change he is 
interested in.

Current status of this change is that you send a mail with nearly 300 
people on CC.

Do you really expect to get an reviewed-by or acked-by on this single 
patch from all of them?

If yes then it somehow makes sense to send the patch bit by bit, if no 
then it doesn't seem to make to much sense to CC them all individually.

>>>> I've never read the bsg code before, but that's certainly not correct. And
>>>> that incorrect pattern repeats over and over again in this code.
>>>>
>>>> Apart from that why the heck do you want to allocate more than 1<<31 handles?
>>> tc action indexes for example. That is part of this patchset.
>> Well, let me refine the question: Why does tc action indexes need more than
>> 31 bits? From an outside view that looks like pure overkill.
> That is current state, uapi. We have to live with it.

Is the range to allocate from part of the uapi or what is the issue here?

If the issue is that userspace can specify the handle then I suggest 
that you use the radix tree directly instead of the idr wrapper around it.

Regards,
Christian.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  8:31     ` Christian König
@ 2017-08-16  8:39       ` Jiri Pirko
  2017-08-16  8:55         ` Christian König
  2017-08-16 14:28       ` David Laight
  1 sibling, 1 reply; 49+ messages in thread
From: Jiri Pirko @ 2017-08-16  8:39 UTC (permalink / raw)
  To: Christian König; +Cc: Chris Mi, netdev

Wed, Aug 16, 2017 at 10:31:35AM CEST, christian.koenig@amd.com wrote:
>Am 16.08.2017 um 10:16 schrieb Jiri Pirko:
>> Wed, Aug 16, 2017 at 09:49:07AM CEST, christian.koenig@amd.com wrote:
>> > Am 16.08.2017 um 04:12 schrieb Chris Mi:
>> > > Using current TC code, it is very slow to insert a lot of rules.
>> > > 
>> > > In order to improve the rules update rate in TC,
>> > > we introduced the following two changes:
>> > >           1) changed cls_flower to use IDR to manage the filters.
>> > >           2) changed all act_xxx modules to use IDR instead of
>> > >              a small hash table
>> > > 
>> > > But IDR has a limitation that it uses int. TC handle uses u32.
>> > > To make sure there is no regression, we also changed IDR to use
>> > > unsigned long. All clients of IDR are changed to use new IDR API.
>> > WOW, wait a second. The idr change is touching a lot of drivers and to be
>> > honest doesn't looks correct at all.
>> > 
>> > Just look at the first chunk of your modification:
>> > > @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>> > >    	mutex_lock(&bsg_mutex);
>> > > -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
>> > > -	if (ret < 0) {
>> > > +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
>> > > +			GFP_KERNEL);
>> > > +	if (ret) {
>> > >    		if (ret == -ENOSPC) {
>> > >    			printk(KERN_ERR "bsg: too many bsg devices\n");
>> > >    			ret = -EINVAL;
>> > The condition "if (ret)" will now always be true after the first allocation
>> > and so we always run into the error handling after that.
>> On success, idr_alloc returns 0.
>
>Ah, I see. You change the idr_alloc to return the resulting index as separate
>parameter.
>
>You should explicit note that in the commit message, cause that is something
>easily overlooked.
>
>In general I strongly suggest to add a separate interface for allocating
>unsigned long handles, use that for the while being and then move the
>existing drivers over bit by bit.
>
>A single patch which touches so many different driver is practically
>impossible to review consequently.

Understood. I think is is good to avoid having some "idr_alloc2". That
is why I suggested to do this in one go, to avoid "idr_alloc2" and then
patch to rename "idr_alloc2" to "idr_alloc" once nobody uses the original
"idr_alloc". In fact, if you do it driver, by driver, the review burden
would be the same, probably even bigger, you'll just have 100+ patches.
Why would it help?

I believe that the changes in drivers are trivial enough to have it in
one patch.


>
>> > I've never read the bsg code before, but that's certainly not correct. And
>> > that incorrect pattern repeats over and over again in this code.
>> > 
>> > Apart from that why the heck do you want to allocate more than 1<<31 handles?
>> tc action indexes for example. That is part of this patchset.
>
>Well, let me refine the question: Why does tc action indexes need more than
>31 bits? From an outside view that looks like pure overkill.

That is current state, uapi. We have to live with it.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  8:16   ` Jiri Pirko
@ 2017-08-16  8:31     ` Christian König
  2017-08-16  8:39       ` Jiri Pirko
  2017-08-16 14:28       ` David Laight
  0 siblings, 2 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  8:31 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Chris Mi, netdev

Am 16.08.2017 um 10:16 schrieb Jiri Pirko:
> Wed, Aug 16, 2017 at 09:49:07AM CEST, christian.koenig@amd.com wrote:
>> Am 16.08.2017 um 04:12 schrieb Chris Mi:
>>> Using current TC code, it is very slow to insert a lot of rules.
>>>
>>> In order to improve the rules update rate in TC,
>>> we introduced the following two changes:
>>>           1) changed cls_flower to use IDR to manage the filters.
>>>           2) changed all act_xxx modules to use IDR instead of
>>>              a small hash table
>>>
>>> But IDR has a limitation that it uses int. TC handle uses u32.
>>> To make sure there is no regression, we also changed IDR to use
>>> unsigned long. All clients of IDR are changed to use new IDR API.
>> WOW, wait a second. The idr change is touching a lot of drivers and to be
>> honest doesn't looks correct at all.
>>
>> Just look at the first chunk of your modification:
>>> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>>>    	mutex_lock(&bsg_mutex);
>>> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
>>> -	if (ret < 0) {
>>> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
>>> +			GFP_KERNEL);
>>> +	if (ret) {
>>>    		if (ret == -ENOSPC) {
>>>    			printk(KERN_ERR "bsg: too many bsg devices\n");
>>>    			ret = -EINVAL;
>> The condition "if (ret)" will now always be true after the first allocation
>> and so we always run into the error handling after that.
> On success, idr_alloc returns 0.

Ah, I see. You change the idr_alloc to return the resulting index as 
separate parameter.

You should explicit note that in the commit message, cause that is 
something easily overlooked.

In general I strongly suggest to add a separate interface for allocating 
unsigned long handles, use that for the while being and then move the 
existing drivers over bit by bit.

A single patch which touches so many different driver is practically 
impossible to review consequently.

>> I've never read the bsg code before, but that's certainly not correct. And
>> that incorrect pattern repeats over and over again in this code.
>>
>> Apart from that why the heck do you want to allocate more than 1<<31 handles?
> tc action indexes for example. That is part of this patchset.

Well, let me refine the question: Why does tc action indexes need more 
than 31 bits? From an outside view that looks like pure overkill.

Regards,
Christian.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  7:49   ` Christian König
                     ` (2 preceding siblings ...)
  (?)
@ 2017-08-16  8:16   ` Jiri Pirko
  2017-08-16  8:31     ` Christian König
  -1 siblings, 1 reply; 49+ messages in thread
From: Jiri Pirko @ 2017-08-16  8:16 UTC (permalink / raw)
  To: Christian König; +Cc: Chris Mi, netdev

Wed, Aug 16, 2017 at 09:49:07AM CEST, christian.koenig@amd.com wrote:
>Am 16.08.2017 um 04:12 schrieb Chris Mi:
>> Using current TC code, it is very slow to insert a lot of rules.
>> 
>> In order to improve the rules update rate in TC,
>> we introduced the following two changes:
>>          1) changed cls_flower to use IDR to manage the filters.
>>          2) changed all act_xxx modules to use IDR instead of
>>             a small hash table
>> 
>> But IDR has a limitation that it uses int. TC handle uses u32.
>> To make sure there is no regression, we also changed IDR to use
>> unsigned long. All clients of IDR are changed to use new IDR API.
>
>WOW, wait a second. The idr change is touching a lot of drivers and to be
>honest doesn't looks correct at all.
>
>Just look at the first chunk of your modification:
>> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>>   	mutex_lock(&bsg_mutex);
>> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
>> -	if (ret < 0) {
>> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
>> +			GFP_KERNEL);
>> +	if (ret) {
>>   		if (ret == -ENOSPC) {
>>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>>   			ret = -EINVAL;
>The condition "if (ret)" will now always be true after the first allocation
>and so we always run into the error handling after that.

On success, idr_alloc returns 0.


>
>I've never read the bsg code before, but that's certainly not correct. And
>that incorrect pattern repeats over and over again in this code.
>
>Apart from that why the heck do you want to allocate more than 1<<31 handles?

tc action indexes for example. That is part of this patchset.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  7:49   ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev
  Cc: aditr, stern, agk, alexander.shishkin, alexandre.bounine,
	alexander.deucher, oakad, ast, elder, adobriyan, alex.williamson,
	AlexBin.Xie, viro, amd-gfx, amitkarwar, andresx7,
	andrew.donnellan, afd, akpm, anil.gurumurthy, anna.schumaker,
	acme, arnd, dedekind1, ashutosh.dixit, ath10k, Bart.VanAssche,
	bhaktipriya96, bjorn.andersson, boris.brezillon,
	computersforpeace, bryan.thompson, cgroups, 3chas3, ccaulfie,
	chris, david1.zhou, cluster-devel, colin.king, xiyou.wangcong,
	cyrille.pitchen, daniel, daniel.vetter,
	dasaratharaman.chandramouli, airlied, dsa, airlied, david.binder,
	dhowells, david.kershner, dtwlin, dave, davem, teigland,
	dwindsor, dwmw2, dennis.dalessandro, devel, devesh.sharma,
	devicetree, dick.kennedy, dm-devel, don.hiatt, dgilbert,
	dledford, drbd-dev, dri-devel, elena.reshetova, edumazet, eparis,
	ericvh, ebiederm, evan.quan, felipe.balbi, Felix.Kuehling,
	f.fainelli, fw, frowand.list, fbarrat, fujita.tomonori, gbhat,
	geliangtang, kraxel, gregkh, greybus-dev, linux, gustavo.padovan,
	hal.rosenstock, hannes, hare, ishkamiel, hans.westgaard.ry,
	ray.huang, mingo, inki.dae, intel-gfx, intel-gvt-dev, iommu,
	ira.weiny, jinpu.wang, jhs, jejb, james.smart, jani.nikula, jack,
	jarkko.sakkinen, jarno, Jason, jgunthorpe, jasowang, javier,
	bfields, jlayton, axboe, jens.wiklander, jiangyilism, jiri, jiri,
	jlbec, joro, johan, johannes, hannes, john, jonathanh, jon.maloy,
	joonas.lahtinen, jy0922.shim, jbacik, Jerry.Zhang, jsarha,
	Kai.Makisara, kvalo, keescook, krzk, kgene, kvm, kyungmin.park,
	jiangshanlai, lars.ellenberg, lucho, lee.jones, leo.liu, leon,
	linux1394-devel, linux-arm-kernel, linux-atm-general,
	linux-block, linux-i2c, linux-kernel, linux-mm, linux-mtd,
	linux-nfs, linux-pm, linuxppc-dev, linux-ppp, linux-raid,
	linux-rdma, linux-remoteproc, linux-samsung-soc, linux-scsi,
	linux-sctp, linux-tegra, linux-usb, linux-wireless, logang, majd,
	manfred, tpmdd, marcos.souza.org, marek.vasut, mario.kleiner.de,
	markb, mfasheh, elfring, martin.petersen, matan, mawilcox,
	mporter, mchehab, maximlevitsky, mst, mhocko, michel.daenzer,
	mike.marciniszyn, rppt, snitzer, mszeredi, minchan, tom.leiming,
	monis, Monk.Liu, nbd-general, neilb, nhorman, nab,
	nicolai.haehnle, nicolas.dichtel, niranjana.vishwanathapura,
	nishants, ngupta, ocfs2-devel, ohad, oneukum, osandov, ogerlitz,
	pali.rohar, pantelis.antoniou, paulus, paul, peterhuewe, peterz,
	pmladek, philipp.reisner, pshelar, rjw, richard, rlove, robh+dt,
	giometti, rogerq, roman.kapl, rminnich, rmk+kernel,
	sainath.grandhi, sameer.wadgaonkar, sean.hefty, seanpaul,
	bigeasy, sre, nsekhar, selvin.xavier, sergey.senozhatsky.work,
	sw0312.kim, p.shailesh, shli, shaun.tancheff, syeh,
	sparmaintainer, stefanr, sboyd, stephen, swise,
	sudarsana.kalluru, sudeep.dutt, sumit.semwal, target-devel, tj,
	thierry.reding, thellstrom, timothy.sell, tipc-discussion,
	tomas.winkler, tomi.valkeinen, tpmdd-devel, trond.myklebust,
	v9fs-developer, varun, virtualization, vdavydov.dev, vyasevich,
	linux-graphics-maintainer, longman, weiyj.lk, wsa, huxm,
	ying.xue, yishaih, yuval.shaia, lizefan, zhenyuw, zhi.a.wang

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  7:49   ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: lucho-OnYtXJJ0/fesTnJN9+BGXg,
	sergey.senozhatsky.work-Re5JQEeQqe8AvxtiuMwx3w,
	snitzer-H+wXaHxf7aLQT0dZR+AlfA, wsa-z923LK4zBo2bacvFa/9K2g,
	markb-VPRAkNaXOzVWk0Htik3J/w, tom.leiming-Re5JQEeQqe8AvxtiuMwx3w,
	stefanr-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB,
	zhi.a.wang-ral2JQCrhuEAvxtiuMwx3w, nsekhar-l0cyMroinI0,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	bfields-uC3wQj2KruNg9hUCZPvPmw,
	linux-sctp-u79uwXL29TY76Z2rM5mHXA, paulus-eUNUBHrolfbYtjvyW6yDsg,
	jinpu.wang-EIkl63zCoXaH+58JC4qpiA, pshelar-LZ6Gd1LRuIk,
	sumit.semwal-QSEj5FYQhm4dnm+yROfE0A, AlexBin.Xie-5C7GfCeVMHo,
	david1.zhou-5C7GfCeVMHo,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w,
	sudarsana.kalluru-h88ZbnxC6KDQT0dZR+AlfA,
	marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
	linux-atm-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	dtwlin-Re5JQEeQqe8AvxtiuMwx3w, michel.daenzer-5C7GfCeVMHo,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	longman-H+wXaHxf7aLQT0dZR+AlfA,
	niranjana.vishwanathapura-ral2JQCrhuEAvxtiuMwx3w,
	philipp.reisner-63ez5xqkn6DQT0dZR+AlfA,
	shli-DgEjT+Ai2ygdnm+yROfE0A, linux-0h96xk9xTtrk1uMJSBkQmQ,
	ohad-Ix1uc/W3ht7QT0dZR+AlfA, pmladek-IBi9RG/b67k,
	dick.kennedy-dY08KVG/lbpWk0Htik3J/w

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  2:12 ` Chris Mi
                   ` (5 preceding siblings ...)
  (?)
@ 2017-08-16  7:49 ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  2:12 ` Chris Mi
                   ` (6 preceding siblings ...)
  (?)
@ 2017-08-16  7:49 ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp, paulus,
	jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie, david1.zhou,
	linux-samsung-soc, maximlevitsky, sudarsana.kalluru, marek.vasut,
	linux-atm-general, dtwlin, michel.daenzer, dledford, tpmdd-devel,
	stern, longman, niranjana.vishwanathapura, philipp.reisner, shli,
	linux, ohad, pmladek, dick.kennedy, linux-pm, ericvh

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  2:12 ` Chris Mi
                   ` (4 preceding siblings ...)
  (?)
@ 2017-08-16  7:49 ` Christian König
  -1 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp, paulus,
	jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie, david1.zhou,
	linux-samsung-soc, maximlevitsky, sudarsana.kalluru, marek.vasut,
	linux-atm-general, dtwlin, michel.daenzer, dledford, tpmdd-devel,
	stern, longman, niranjana.vishwanathapura, philipp.reisner, shli,
	linux, ohad, pmladek, dick.kennedy, linux-pm, ericv

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  7:49   ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: lucho-OnYtXJJ0/fesTnJN9+BGXg,
	sergey.senozhatsky.work-Re5JQEeQqe8AvxtiuMwx3w,
	snitzer-H+wXaHxf7aLQT0dZR+AlfA, wsa-z923LK4zBo2bacvFa/9K2g,
	markb-VPRAkNaXOzVWk0Htik3J/w, tom.leiming-Re5JQEeQqe8AvxtiuMwx3w,
	stefanr-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB,
	zhi.a.wang-ral2JQCrhuEAvxtiuMwx3w, nsekhar-l0cyMroinI0,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	bfields-uC3wQj2KruNg9hUCZPvPmw,
	linux-sctp-u79uwXL29TY76Z2rM5mHXA, paulus-eUNUBHrolfbYtjvyW6yDsg,
	jinpu.wang-EIkl63zCoXaH+58JC4qpiA, pshelar-LZ6Gd1LRuIk,
	sumit.semwal-QSEj5FYQhm4dnm+yROfE0A, AlexBin.Xie-5C7GfCeVMHo,
	david1.zhou-5C7GfCeVMHo,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w,
	sudarsana.kalluru-h88ZbnxC6KDQT0dZR+AlfA,
	marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
	linux-atm-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	dtwlin-Re5JQEeQqe8AvxtiuMwx3w, michel.daenzer-5C7GfCeVMHo,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	longman-H+wXaHxf7aLQT0dZR+AlfA,
	niranjana.vishwanathapura-ral2JQCrhuEAvxtiuMwx3w,
	philipp.reisner-63ez5xqkn6DQT0dZR+AlfA,
	shli-DgEjT+Ai2ygdnm+yROfE0A, linux-0h96xk9xTtrk1uMJSBkQmQ,
	ohad-Ix1uc/W3ht7QT0dZR+AlfA, pmladek-IBi9RG/b67k,
	dick.kennedy-dY08KVG/lbpWk0Htik3J/w, linu

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  7:49   ` Christian König
  0 siblings, 0 replies; 49+ messages in thread
From: Christian König @ 2017-08-16  7:49 UTC (permalink / raw)
  To: Chris Mi, netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy,
	linux-pm, ericvh, geliangtang, sparmaintainer, giometti, acme,
	inki.dae, alex.williamson, rppt, teigland, viro, ishkamiel,
	weiyj.lk, marcos.souza.org, mike.marciniszyn, elder, nbd-general,
	nhorman, nicolai.haehnle, david.binder, gregkh, linux-usb,
	anil.gurumurthy, linux-kernel, varun, majd, devesh.sharma,
	sameer.wadgaonkar, bhaktipriya96, alexander.deucher,
	shaun.tancheff, akpm, matan, jlbec, kraxel, Jason, timothy.sell,
	airlied, linux-wireless, pantelis.antoniou, sudeep.dutt, neilb,
	edumazet, target-devel, linux-i2c, daniel.vetter, jsarha,
	osandov, agk, drbd-dev, boris.brezillon, thellstrom, dave, paul,
	leon, sainath.grandhi, gustavo.padovan, james.smart, jonathanh,
	selvin.xavier, kgene, linux-graphics-maintainer, andresx7,
	3chas3, airlied, sean.hefty, virtualization, hal.rosenstock, tj,
	mszeredi, hannes, felipe.balbi, pali.rohar, tpmdd, linuxppc-dev,
	jani.nikula, greybus-dev, nishants, swise, yuval.shaia,
	xiyou.wangcong, evan.quan, lars.ellenberg, linux-arm-kernel,
	dwindsor, linux-raid, syeh, bryan.thompson, ying.xue,
	Felix.Kuehling, oneukum, fw, anna.schumaker, minchan,
	kyungmin.park, monis, ebiederm, sre, don.hiatt, leo.liu,
	jens.wiklander, hans.westgaard.ry, alexander.shishkin,
	dennis.dalessandro, jasowang, joonas.lahtinen, jiangshanlai, ast,
	fbarrat, mhocko, alexandre.bounine, linux-mtd, amd-gfx, cgroups,
	jlayton, frowand.list, elena.reshetova, f.fainelli, jejb, daniel,
	linux-rdma, p.shailesh, ath10k, jgunthorpe, ccaulfie,
	tomi.valkeinen, Monk.Liu, dgilbert, ira.weiny, david.kershner,
	adobriyan, jon.maloy, keescook, arnd, intel-gfx, jhs, zhenyuw,
	v9fs-developer, rmk+kernel, seanpaul, nab, Jerry.Zhang, eparis,
	nicolas.dichtel, chris, mporter, rogerq, linux-nfs,
	martin.petersen, linux-ppp, dm-devel, sw0312.kim,
	fujita.tomonori, iommu, roman.kapl, ngupta, andrew.donnellan,
	cyrille.pitchen, thierry.reding, colin.king, computersforpeace,
	logang, davem, ocfs2-devel, rlove, jack, kvm, mst, peterz,
	bigeasy, trond.myklebust, linux-remoteproc, amitkarwar,
	bjorn.andersson, dhowells, linux-mm, ray.huang, jiri, peterhuewe,
	linux1394-devel, lee.jones, john, devel, stephen,
	mario.kleiner.de, manfred, oakad, linux-scsi, mawilcox, mfasheh,
	richard, joro, jiangyilism, elfring, cluster-devel, javier,
	jarkko.sakkinen, mingo, vdavydov.dev, kvalo, tipc-discussion,
	ogerlitz, devicetree, lizefan, huxm, mchehab, johan, aditr,
	linux-block, robh+dt, Kai.Makisara, hare, rminnich, linux-tegra,
	dsa, intel-gvt-dev, jy0922.shim, axboe, gbhat, tomas.winkler,
	dedekind1, jbacik, jarno, vyasevich, krzk, sboyd, jiri, afd,
	ashutosh.dixit, yishaih, rjw, hannes, Bart.VanAssche, johannes,
	dwmw2, dasaratharaman.chandramouli

Am 16.08.2017 um 04:12 schrieb Chris Mi:
> Using current TC code, it is very slow to insert a lot of rules.
>
> In order to improve the rules update rate in TC,
> we introduced the following two changes:
>          1) changed cls_flower to use IDR to manage the filters.
>          2) changed all act_xxx modules to use IDR instead of
>             a small hash table
>
> But IDR has a limitation that it uses int. TC handle uses u32.
> To make sure there is no regression, we also changed IDR to use
> unsigned long. All clients of IDR are changed to use new IDR API.

WOW, wait a second. The idr change is touching a lot of drivers and to 
be honest doesn't looks correct at all.

Just look at the first chunk of your modification:
> @@ -998,8 +999,9 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
>   
>   	mutex_lock(&bsg_mutex);
>   
> -	ret = idr_alloc(&bsg_minor_idr, bcd, 0, BSG_MAX_DEVS, GFP_KERNEL);
> -	if (ret < 0) {
> +	ret = idr_alloc(&bsg_minor_idr, bcd, &idr_index, 0, BSG_MAX_DEVS,
> +			GFP_KERNEL);
> +	if (ret) {
>   		if (ret == -ENOSPC) {
>   			printk(KERN_ERR "bsg: too many bsg devices\n");
>   			ret = -EINVAL;
The condition "if (ret)" will now always be true after the first 
allocation and so we always run into the error handling after that.

I've never read the bsg code before, but that's certainly not correct. 
And that incorrect pattern repeats over and over again in this code.

Apart from that why the heck do you want to allocate more than 1<<31 
handles?

Regards,
Christian.

>
> Chris Mi (3):
>    idr: Use unsigned long instead of int
>    net/sched: Change cls_flower to use IDR
>    net/sched: Change act_api and act_xxx modules to use IDR
>
>   block/bsg.c                                     |   8 +-
>   block/genhd.c                                   |  12 +-
>   drivers/atm/nicstar.c                           |  11 +-
>   drivers/block/drbd/drbd_main.c                  |  31 +--
>   drivers/block/drbd/drbd_nl.c                    |  22 ++-
>   drivers/block/drbd/drbd_proc.c                  |   3 +-
>   drivers/block/drbd/drbd_receiver.c              |  15 +-
>   drivers/block/drbd/drbd_state.c                 |  34 ++--
>   drivers/block/drbd/drbd_worker.c                |   6 +-
>   drivers/block/loop.c                            |  17 +-
>   drivers/block/nbd.c                             |  20 +-
>   drivers/block/zram/zram_drv.c                   |   9 +-
>   drivers/char/tpm/tpm-chip.c                     |  10 +-
>   drivers/char/tpm/tpm.h                          |   2 +-
>   drivers/dca/dca-sysfs.c                         |   9 +-
>   drivers/firewire/core-cdev.c                    |  18 +-
>   drivers/firewire/core-device.c                  |  15 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
>   drivers/gpu/drm/drm_auth.c                      |   9 +-
>   drivers/gpu/drm/drm_connector.c                 |  10 +-
>   drivers/gpu/drm/drm_context.c                   |  20 +-
>   drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
>   drivers/gpu/drm/drm_drv.c                       |   6 +-
>   drivers/gpu/drm/drm_gem.c                       |  19 +-
>   drivers/gpu/drm/drm_info.c                      |   2 +-
>   drivers/gpu/drm/drm_mode_object.c               |  11 +-
>   drivers/gpu/drm/drm_syncobj.c                   |  18 +-
>   drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
>   drivers/gpu/drm/i915/gvt/display.c              |   2 +-
>   drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
>   drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
>   drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
>   drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
>   drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
>   drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
>   drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
>   drivers/gpu/drm/tegra/drm.c                     |  10 +-
>   drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
>   drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
>   drivers/gpu/drm/via/via_mm.c                    |   8 +-
>   drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
>   drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
>   drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
>   drivers/i2c/i2c-core-base.c                     |  19 +-
>   drivers/infiniband/core/cm.c                    |   8 +-
>   drivers/infiniband/core/cma.c                   |  12 +-
>   drivers/infiniband/core/rdma_core.c             |   9 +-
>   drivers/infiniband/core/sa_query.c              |  23 +--
>   drivers/infiniband/core/ucm.c                   |   7 +-
>   drivers/infiniband/core/ucma.c                  |  14 +-
>   drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
>   drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
>   drivers/infiniband/hw/cxgb4/device.c            |  18 +-
>   drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
>   drivers/infiniband/hw/hfi1/init.c               |   9 +-
>   drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
>   drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
>   drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
>   drivers/infiniband/hw/qib/qib_init.c            |   9 +-
>   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
>   drivers/iommu/intel-svm.c                       |   9 +-
>   drivers/md/dm.c                                 |  13 +-
>   drivers/memstick/core/memstick.c                |  10 +-
>   drivers/memstick/core/ms_block.c                |   9 +-
>   drivers/memstick/core/mspro_block.c             |  12 +-
>   drivers/mfd/rtsx_pcr.c                          |   9 +-
>   drivers/misc/c2port/core.c                      |   7 +-
>   drivers/misc/cxl/context.c                      |   8 +-
>   drivers/misc/cxl/main.c                         |  15 +-
>   drivers/misc/mei/main.c                         |   8 +-
>   drivers/misc/mic/scif/scif_api.c                |  11 +-
>   drivers/misc/mic/scif/scif_ports.c              |  18 +-
>   drivers/misc/tifm_core.c                        |   9 +-
>   drivers/mtd/mtdcore.c                           |   9 +-
>   drivers/mtd/mtdcore.h                           |   2 +-
>   drivers/mtd/ubi/block.c                         |   7 +-
>   drivers/net/ppp/ppp_generic.c                   |  27 +--
>   drivers/net/tap.c                               |  10 +-
>   drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
>   drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
>   drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
>   drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
>   drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
>   drivers/of/overlay.c                            |  15 +-
>   drivers/of/unittest.c                           |  25 ++-
>   drivers/power/supply/bq2415x_charger.c          |  16 +-
>   drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
>   drivers/power/supply/ds2782_battery.c           |   9 +-
>   drivers/powercap/powercap_sys.c                 |   8 +-
>   drivers/pps/pps.c                               |  10 +-
>   drivers/rapidio/rio_cm.c                        |  17 +-
>   drivers/remoteproc/remoteproc_core.c            |   8 +-
>   drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
>   drivers/scsi/bfa/bfad_im.c                      |   8 +-
>   drivers/scsi/ch.c                               |   8 +-
>   drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
>   drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
>   drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
>   drivers/scsi/sg.c                               |  10 +-
>   drivers/scsi/st.c                               |   8 +-
>   drivers/staging/greybus/uart.c                  |  22 +--
>   drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
>   drivers/target/iscsi/iscsi_target.c             |   7 +-
>   drivers/target/iscsi/iscsi_target_login.c       |   9 +-
>   drivers/target/target_core_device.c             |   9 +-
>   drivers/target/target_core_user.c               |  13 +-
>   drivers/tee/tee_shm.c                           |   8 +-
>   drivers/uio/uio.c                               |   9 +-
>   drivers/usb/class/cdc-acm.c                     |  24 +--
>   drivers/usb/core/devices.c                      |   2 +-
>   drivers/usb/core/hcd.c                          |   7 +-
>   drivers/usb/mon/mon_main.c                      |   3 +-
>   drivers/usb/serial/usb-serial.c                 |  11 +-
>   drivers/vfio/vfio.c                             |  15 +-
>   fs/dlm/lock.c                                   |   9 +-
>   fs/dlm/lockspace.c                              |   6 +-
>   fs/dlm/recover.c                                |  10 +-
>   fs/nfs/nfs4client.c                             |   9 +-
>   fs/nfsd/nfs4state.c                             |   8 +-
>   fs/notify/inotify/inotify_fsnotify.c            |   4 +-
>   fs/notify/inotify/inotify_user.c                |   9 +-
>   fs/ocfs2/cluster/tcp.c                          |  10 +-
>   include/linux/idr.h                             |  26 +--
>   include/linux/of.h                              |   4 +-
>   include/linux/radix-tree.h                      |   2 +-
>   include/net/9p/9p.h                             |   2 +-
>   include/net/act_api.h                           |  76 +++-----
>   ipc/msg.c                                       |   2 +-
>   ipc/sem.c                                       |   2 +-
>   ipc/shm.c                                       |   4 +-
>   ipc/util.c                                      |  17 +-
>   kernel/bpf/syscall.c                            |  20 +-
>   kernel/cgroup/cgroup.c                          |  57 +++---
>   kernel/events/core.c                            |  10 +-
>   kernel/workqueue.c                              |  15 +-
>   lib/idr.c                                       |  38 ++--
>   lib/radix-tree.c                                |   5 +-
>   mm/memcontrol.c                                 |  11 +-
>   net/9p/client.c                                 |  17 +-
>   net/9p/util.c                                   |  14 +-
>   net/core/net_namespace.c                        |  23 ++-
>   net/mac80211/cfg.c                              |  23 +--
>   net/mac80211/iface.c                            |   3 +-
>   net/mac80211/main.c                             |   2 +-
>   net/mac80211/tx.c                               |   7 +-
>   net/mac80211/util.c                             |   3 +-
>   net/netlink/genetlink.c                         |  18 +-
>   net/qrtr/qrtr.c                                 |  21 +-
>   net/rxrpc/conn_client.c                         |  15 +-
>   net/sched/act_api.c                             | 249 +++++++++++-------------
>   net/sched/act_bpf.c                             |  17 +-
>   net/sched/act_connmark.c                        |  16 +-
>   net/sched/act_csum.c                            |  16 +-
>   net/sched/act_gact.c                            |  16 +-
>   net/sched/act_ife.c                             |  20 +-
>   net/sched/act_ipt.c                             |  26 ++-
>   net/sched/act_mirred.c                          |  19 +-
>   net/sched/act_nat.c                             |  16 +-
>   net/sched/act_pedit.c                           |  18 +-
>   net/sched/act_police.c                          |  18 +-
>   net/sched/act_sample.c                          |  17 +-
>   net/sched/act_simple.c                          |  20 +-
>   net/sched/act_skbedit.c                         |  18 +-
>   net/sched/act_skbmod.c                          |  18 +-
>   net/sched/act_tunnel_key.c                      |  20 +-
>   net/sched/act_vlan.c                            |  22 +--
>   net/sched/cls_flower.c                          |  55 +++---
>   net/sctp/associola.c                            |   8 +-
>   net/tipc/server.c                               |   7 +-
>   172 files changed, 1256 insertions(+), 1113 deletions(-)
>


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 49+ messages in thread

* RE: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  3:05 ` David Miller
@ 2017-08-16  3:38   ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  3:38 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Hi David,

Thanks for your suggestion.  If needed, I could send the review request again
without so long CC: list.  I surely will avoid such mistake in the future.

Thanks,
Chris

> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, August 16, 2017 11:06 AM
> To: Chris Mi <chrism@mellanox.com>
> Cc: netdev@vger.kernel.org
> Subject: Re: [patch net-next 0/3] net/sched: Improve getting objects by
> indexes
> 
> 
> The CC: list you used for these postings was way too large.
> 
> Seriously, netdev by itself or with one or two _specific_ developers added
> would have been more than sufficient.
> 
> If you are automating things using the MAINTAINERS file, always look over
> the result by hand and ask yourself "Do I really have to
> CC: everything listed in this thing?"
> 
> Thanks.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [patch net-next 0/3] net/sched: Improve getting objects by indexes
  2017-08-16  2:12 ` Chris Mi
                   ` (2 preceding siblings ...)
  (?)
@ 2017-08-16  3:05 ` David Miller
  2017-08-16  3:38   ` Chris Mi
  -1 siblings, 1 reply; 49+ messages in thread
From: David Miller @ 2017-08-16  3:05 UTC (permalink / raw)
  To: chrism; +Cc: netdev


The CC: list you used for these postings was way too large.

Seriously, netdev by itself or with one or two _specific_ developers
added would have been more than sufficient.

If you are automating things using the MAINTAINERS file, always
look over the result by hand and ask yourself "Do I really have to
CC: everything listed in this thing?"

Thanks.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev
  Cc: aditr, stern, agk, alexander.shishkin, alexandre.bounine,
	alexander.deucher, oakad, ast, elder, adobriyan, alex.williamson,
	AlexBin.Xie, viro, amd-gfx, amitkarwar, andresx7,
	andrew.donnellan, afd, akpm, anil.gurumurthy, anna.schumaker,
	acme, arnd, dedekind1, ashutosh.dixit, ath10k, Bart.VanAssche,
	bhaktipriya96, bjorn.andersson, boris.brezillon,
	computersforpeace, bryan.thompson, cgroups, 3chas3, chrism,
	christian.koenig, ccaulfie, chris, david1.zhou, cluster-devel,
	colin.king, xiyou.wangcong, cyrille.pitchen, daniel,
	daniel.vetter, dasaratharaman.chandramouli, airlied, dsa,
	airlied, david.binder, dhowells, david.kershner, dtwlin, dave,
	davem, teigland, dwindsor, dwmw2, dennis.dalessandro, devel,
	devesh.sharma, devicetree, dick.kennedy, dm-devel, don.hiatt,
	dgilbert, dledford, drbd-dev, dri-devel, elena.reshetova,
	edumazet, eparis, ericvh, ebiederm, evan.quan, felipe.balbi,
	Felix.Kuehling, f.fainelli, fw, frowand.list, fbarrat,
	fujita.tomonori, gbhat, geliangtang, kraxel, gregkh, greybus-dev,
	linux, gustavo.padovan, hal.rosenstock, hannes, hare, ishkamiel,
	hans.westgaard.ry, ray.huang, mingo, inki.dae, intel-gfx,
	intel-gvt-dev, iommu, ira.weiny, jinpu.wang, jhs, jejb,
	james.smart, jani.nikula, jack, jarkko.sakkinen, jarno, Jason,
	jgunthorpe, jasowang, javier, bfields, jlayton, axboe,
	jens.wiklander, jiangyilism, jiri, jiri, jlbec, joro, johan,
	johannes, hannes, john, jonathanh, jon.maloy, joonas.lahtinen,
	jy0922.shim, jbacik, Jerry.Zhang, jsarha, Kai.Makisara, kvalo,
	keescook, krzk, kgene, kvm, kyungmin.park, jiangshanlai,
	lars.ellenberg, lucho, lee.jones, leo.liu, leon, linux1394-devel,
	linux-arm-kernel, linux-atm-general, linux-block, linux-i2c,
	linux-kernel, linux-mm, linux-mtd, linux-nfs, linux-pm,
	linuxppc-dev, linux-ppp, linux-raid, linux-rdma,
	linux-remoteproc, linux-samsung-soc, linux-scsi, linux-sctp,
	linux-tegra, linux-usb, linux-wireless, logang, majd, manfred,
	tpmdd, marcos.souza.org, marek.vasut, mario.kleiner.de, markb,
	mfasheh, elfring, martin.petersen, matan, mawilcox, mporter,
	mchehab, maximlevitsky, mst, mhocko, michel.daenzer,
	mike.marciniszyn, rppt, snitzer, mszeredi, minchan, tom.leiming,
	monis, Monk.Liu, nbd-general, neilb, nhorman, nab,
	nicolai.haehnle, nicolas.dichtel, niranjana.vishwanathapura,
	nishants, ngupta, ocfs2-devel, ohad, oneukum, osandov, ogerlitz,
	pali.rohar, pantelis.antoniou, paulus, paul, peterhuewe, peterz,
	pmladek, philipp.reisner, pshelar, rjw, richard, rlove, robh+dt,
	giometti, rogerq, roman.kapl, rminnich, rmk+kernel,
	sainath.grandhi, sameer.wadgaonkar, sean.hefty, seanpaul,
	bigeasy, sre, nsekhar, selvin.xavier, sergey.senozhatsky.work,
	sw0312.kim, p.shailesh, shli, shaun.tancheff, syeh,
	sparmaintainer, stefanr, sboyd, stephen, swise,
	sudarsana.kalluru, sudeep.dutt, sumit.semwal, target-devel, tj,
	thierry.reding, thellstrom, timothy.sell, tipc-discussion,
	tomas.winkler, tomi.valkeinen, tpmdd-devel, trond.myklebust,
	v9fs-developer, varun, virtualization, vdavydov.dev, vyasevich,
	linux-graphics-maintainer, longman, weiyj.lk, wsa, huxm,
	ying.xue, yishaih, yuval.shaia, lizefan, zhenyuw, zhi.a.wang

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: lucho-OnYtXJJ0/fesTnJN9+BGXg,
	sergey.senozhatsky.work-Re5JQEeQqe8AvxtiuMwx3w,
	snitzer-H+wXaHxf7aLQT0dZR+AlfA, wsa-z923LK4zBo2bacvFa/9K2g,
	markb-VPRAkNaXOzVWk0Htik3J/w, tom.leiming-Re5JQEeQqe8AvxtiuMwx3w,
	stefanr-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB,
	zhi.a.wang-ral2JQCrhuEAvxtiuMwx3w, nsekhar-l0cyMroinI0,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	bfields-uC3wQj2KruNg9hUCZPvPmw,
	linux-sctp-u79uwXL29TY76Z2rM5mHXA, paulus-eUNUBHrolfbYtjvyW6yDsg,
	jinpu.wang-EIkl63zCoXaH+58JC4qpiA, pshelar-LZ6Gd1LRuIk,
	sumit.semwal-QSEj5FYQhm4dnm+yROfE0A, AlexBin.Xie-5C7GfCeVMHo,
	david1.zhou-5C7GfCeVMHo,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w,
	sudarsana.kalluru-h88ZbnxC6KDQT0dZR+AlfA,
	marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
	linux-atm-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	dtwlin-Re5JQEeQqe8AvxtiuMwx3w, michel.daenzer-5C7GfCeVMHo,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	longman-H+wXaHxf7aLQT0dZR+AlfA,
	niranjana.vishwanathapura-ral2JQCrhuEAvxtiuMwx3w,
	philipp.reisner-63ez5xqkn6DQT0dZR+AlfA,
	shli-DgEjT+Ai2ygdnm+yROfE0A, linux-0h96xk9xTtrk1uMJSBkQmQ,
	ohad-Ix1uc/W3ht7QT0dZR+AlfA, pmladek-IBi9RG/b67k,
	dick.kennedy-dY08KVG/lbpWk0Htik3J/w

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp, paulus,
	jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie, david1.zhou,
	linux-samsung-soc, maximlevitsky, sudarsana.kalluru, marek.vasut,
	linux-atm-general, dtwlin, michel.daenzer, dledford, tpmdd-devel,
	stern, longman, niranjana.vishwanathapura, philipp.reisner, shli,
	linux, ohad, pmladek, dick.kennedy, linux-pm, ericvh

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp, paulus,
	jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie, david1.zhou,
	linux-samsung-soc, maximlevitsky, sudarsana.kalluru, marek.vasut,
	linux-atm-general, dtwlin, michel.daenzer, dledford, tpmdd-devel,
	stern, longman, niranjana.vishwanathapura, philipp.reisner, shli,
	linux, ohad, pmladek, dick.kennedy, linux-pm, ericv

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: lucho-OnYtXJJ0/fesTnJN9+BGXg,
	sergey.senozhatsky.work-Re5JQEeQqe8AvxtiuMwx3w,
	snitzer-H+wXaHxf7aLQT0dZR+AlfA, wsa-z923LK4zBo2bacvFa/9K2g,
	markb-VPRAkNaXOzVWk0Htik3J/w, tom.leiming-Re5JQEeQqe8AvxtiuMwx3w,
	stefanr-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB,
	zhi.a.wang-ral2JQCrhuEAvxtiuMwx3w, nsekhar-l0cyMroinI0,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	bfields-uC3wQj2KruNg9hUCZPvPmw,
	linux-sctp-u79uwXL29TY76Z2rM5mHXA, paulus-eUNUBHrolfbYtjvyW6yDsg,
	jinpu.wang-EIkl63zCoXaH+58JC4qpiA, pshelar-LZ6Gd1LRuIk,
	sumit.semwal-QSEj5FYQhm4dnm+yROfE0A, AlexBin.Xie-5C7GfCeVMHo,
	david1.zhou-5C7GfCeVMHo,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w,
	sudarsana.kalluru-h88ZbnxC6KDQT0dZR+AlfA,
	marek.vasut-Re5JQEeQqe8AvxtiuMwx3w,
	linux-atm-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	dtwlin-Re5JQEeQqe8AvxtiuMwx3w, michel.daenzer-5C7GfCeVMHo,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	longman-H+wXaHxf7aLQT0dZR+AlfA,
	niranjana.vishwanathapura-ral2JQCrhuEAvxtiuMwx3w,
	philipp.reisner-63ez5xqkn6DQT0dZR+AlfA,
	shli-DgEjT+Ai2ygdnm+yROfE0A, linux-0h96xk9xTtrk1uMJSBkQmQ,
	ohad-Ix1uc/W3ht7QT0dZR+AlfA, pmladek-IBi9RG/b67k,
	dick.kennedy-dY08KVG/lbpWk0Htik3J/w, linux-

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 49+ messages in thread

* [patch net-next 0/3] net/sched: Improve getting objects by indexes
@ 2017-08-16  2:12 ` Chris Mi
  0 siblings, 0 replies; 49+ messages in thread
From: Chris Mi @ 2017-08-16  2:12 UTC (permalink / raw)
  To: netdev
  Cc: lucho, sergey.senozhatsky.work, snitzer, wsa, markb, tom.leiming,
	stefanr, zhi.a.wang, nsekhar, dri-devel, bfields, linux-sctp,
	paulus, jinpu.wang, pshelar, sumit.semwal, AlexBin.Xie,
	david1.zhou, linux-samsung-soc, maximlevitsky, sudarsana.kalluru,
	marek.vasut, linux-atm-general, dtwlin, michel.daenzer, dledford,
	tpmdd-devel, stern, longman, niranjana.vishwanathapura,
	philipp.reisner, shli, linux, ohad, pmladek, dick.kennedy,
	linux-pm, ericvh, geliangtang, sparmaintainer, giometti, acme,
	inki.dae, alex.williamson, rppt, teigland, viro, anna.schumaker,
	weiyj.lk, chrism, marcos.souza.org, mike.marciniszyn, elder,
	nbd-general, nhorman, nicolai.haehnle, david.binder, gregkh,
	linux-usb, anil.gurumurthy, linux-kernel, varun, majd,
	devesh.sharma, sameer.wadgaonkar, bhaktipriya96,
	alexander.deucher, shaun.tancheff, akpm, matan, jlbec, kraxel,
	Jason, timothy.sell, airlied, linux-wireless, pantelis.antoniou,
	sudeep.dutt, neilb, edumazet, target-devel, linux-i2c,
	daniel.vetter, jsarha, osandov, agk, drbd-dev, boris.brezillon,
	thellstrom, dave, paul, leon, sainath.grandhi, gustavo.padovan,
	james.smart, jonathanh, selvin.xavier, kgene,
	linux-graphics-maintainer, andresx7, 3chas3, airlied, sean.hefty,
	virtualization, hal.rosenstock, tj, mszeredi, hannes,
	felipe.balbi, pali.rohar, tpmdd, linuxppc-dev, jani.nikula,
	greybus-dev, nishants, swise, yuval.shaia, xiyou.wangcong,
	evan.quan, lars.ellenberg, linux-arm-kernel, dwindsor,
	linux-raid, syeh, bryan.thompson, ying.xue, Felix.Kuehling,
	oneukum, fw, davem, minchan, kyungmin.park, monis, ebiederm, sre,
	don.hiatt, leo.liu, jens.wiklander, hans.westgaard.ry,
	alexander.shishkin, dennis.dalessandro, jasowang,
	joonas.lahtinen, jiangshanlai, ast, fbarrat, mhocko,
	alexandre.bounine, linux-mtd, amd-gfx, cgroups, jlayton,
	frowand.list, elena.reshetova, f.fainelli, jejb, daniel,
	linux-rdma, p.shailesh, ath10k, jgunthorpe, ccaulfie,
	tomi.valkeinen, Monk.Liu, dgilbert, ira.weiny, david.kershner,
	adobriyan, jon.maloy, keescook, arnd, intel-gfx, jhs, zhenyuw,
	v9fs-developer, rmk+kernel, seanpaul, nab, Jerry.Zhang, eparis,
	nicolas.dichtel, chris, mporter, rogerq, linux-nfs,
	martin.petersen, linux-ppp, dm-devel, sw0312.kim,
	fujita.tomonori, iommu, roman.kapl, ngupta, andrew.donnellan,
	cyrille.pitchen, thierry.reding, colin.king, computersforpeace,
	logang, christian.koenig, ocfs2-devel, rlove, jack, kvm, mst,
	peterz, bigeasy, trond.myklebust, linux-remoteproc, amitkarwar,
	bjorn.andersson, dhowells, linux-mm, ray.huang, jiri, peterhuewe,
	linux1394-devel, lee.jones, john, devel, stephen,
	mario.kleiner.de, manfred, oakad, linux-scsi, mawilcox, mfasheh,
	richard, joro, jiangyilism, elfring, cluster-devel, javier,
	jarkko.sakkinen, mingo, vdavydov.dev, kvalo, tipc-discussion,
	ogerlitz, ishkamiel, devicetree, lizefan, huxm, mchehab, johan,
	aditr, linux-block, robh+dt, Kai.Makisara, hare, rminnich,
	linux-tegra, dsa, intel-gvt-dev, jy0922.shim, axboe, gbhat,
	tomas.winkler, dedekind1, jbacik, jarno, vyasevich, krzk, sboyd,
	jiri, afd, ashutosh.dixit, yishaih, rjw, hannes, Bart.VanAssche,
	johannes, dwmw2, dasaratharaman.chandramouli

Using current TC code, it is very slow to insert a lot of rules.

In order to improve the rules update rate in TC,
we introduced the following two changes:
        1) changed cls_flower to use IDR to manage the filters.
        2) changed all act_xxx modules to use IDR instead of
           a small hash table

But IDR has a limitation that it uses int. TC handle uses u32.
To make sure there is no regression, we also changed IDR to use
unsigned long. All clients of IDR are changed to use new IDR API.

Chris Mi (3):
  idr: Use unsigned long instead of int
  net/sched: Change cls_flower to use IDR
  net/sched: Change act_api and act_xxx modules to use IDR

 block/bsg.c                                     |   8 +-
 block/genhd.c                                   |  12 +-
 drivers/atm/nicstar.c                           |  11 +-
 drivers/block/drbd/drbd_main.c                  |  31 +--
 drivers/block/drbd/drbd_nl.c                    |  22 ++-
 drivers/block/drbd/drbd_proc.c                  |   3 +-
 drivers/block/drbd/drbd_receiver.c              |  15 +-
 drivers/block/drbd/drbd_state.c                 |  34 ++--
 drivers/block/drbd/drbd_worker.c                |   6 +-
 drivers/block/loop.c                            |  17 +-
 drivers/block/nbd.c                             |  20 +-
 drivers/block/zram/zram_drv.c                   |   9 +-
 drivers/char/tpm/tpm-chip.c                     |  10 +-
 drivers/char/tpm/tpm.h                          |   2 +-
 drivers/dca/dca-sysfs.c                         |   9 +-
 drivers/firewire/core-cdev.c                    |  18 +-
 drivers/firewire/core-device.c                  |  15 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c     |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c         |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c         |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c         |   2 +-
 drivers/gpu/drm/drm_auth.c                      |   9 +-
 drivers/gpu/drm/drm_connector.c                 |  10 +-
 drivers/gpu/drm/drm_context.c                   |  20 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                |  11 +-
 drivers/gpu/drm/drm_drv.c                       |   6 +-
 drivers/gpu/drm/drm_gem.c                       |  19 +-
 drivers/gpu/drm/drm_info.c                      |   2 +-
 drivers/gpu/drm/drm_mode_object.c               |  11 +-
 drivers/gpu/drm/drm_syncobj.c                   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_ipp.c         |  25 ++-
 drivers/gpu/drm/i915/gvt/display.c              |   2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                |   2 +-
 drivers/gpu/drm/i915/gvt/vgpu.c                 |   9 +-
 drivers/gpu/drm/i915/i915_debugfs.c             |   6 +-
 drivers/gpu/drm/i915/i915_gem_context.c         |   9 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                   |   8 +-
 drivers/gpu/drm/qxl/qxl_release.c               |  14 +-
 drivers/gpu/drm/sis/sis_mm.c                    |   8 +-
 drivers/gpu/drm/tegra/drm.c                     |  10 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c    |   3 +-
 drivers/gpu/drm/vgem/vgem_fence.c               |  12 +-
 drivers/gpu/drm/via/via_mm.c                    |   8 +-
 drivers/gpu/drm/virtio/virtgpu_kms.c            |   5 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c             |   5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c        |   9 +-
 drivers/i2c/i2c-core-base.c                     |  19 +-
 drivers/infiniband/core/cm.c                    |   8 +-
 drivers/infiniband/core/cma.c                   |  12 +-
 drivers/infiniband/core/rdma_core.c             |   9 +-
 drivers/infiniband/core/sa_query.c              |  23 +--
 drivers/infiniband/core/ucm.c                   |   7 +-
 drivers/infiniband/core/ucma.c                  |  14 +-
 drivers/infiniband/hw/cxgb3/iwch.c              |   4 +-
 drivers/infiniband/hw/cxgb3/iwch.h              |   4 +-
 drivers/infiniband/hw/cxgb4/device.c            |  18 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h          |   4 +-
 drivers/infiniband/hw/hfi1/init.c               |   9 +-
 drivers/infiniband/hw/hfi1/vnic_main.c          |   6 +-
 drivers/infiniband/hw/mlx4/cm.c                 |  13 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c      |   7 +-
 drivers/infiniband/hw/qib/qib_init.c            |   9 +-
 drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c |  10 +-
 drivers/iommu/intel-svm.c                       |   9 +-
 drivers/md/dm.c                                 |  13 +-
 drivers/memstick/core/memstick.c                |  10 +-
 drivers/memstick/core/ms_block.c                |   9 +-
 drivers/memstick/core/mspro_block.c             |  12 +-
 drivers/mfd/rtsx_pcr.c                          |   9 +-
 drivers/misc/c2port/core.c                      |   7 +-
 drivers/misc/cxl/context.c                      |   8 +-
 drivers/misc/cxl/main.c                         |  15 +-
 drivers/misc/mei/main.c                         |   8 +-
 drivers/misc/mic/scif/scif_api.c                |  11 +-
 drivers/misc/mic/scif/scif_ports.c              |  18 +-
 drivers/misc/tifm_core.c                        |   9 +-
 drivers/mtd/mtdcore.c                           |   9 +-
 drivers/mtd/mtdcore.h                           |   2 +-
 drivers/mtd/ubi/block.c                         |   7 +-
 drivers/net/ppp/ppp_generic.c                   |  27 +--
 drivers/net/tap.c                               |  10 +-
 drivers/net/wireless/ath/ath10k/htt.h           |   3 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c        |  22 ++-
 drivers/net/wireless/ath/ath10k/mac.c           |   2 +-
 drivers/net/wireless/marvell/mwifiex/main.c     |  13 +-
 drivers/net/wireless/marvell/mwifiex/wmm.c      |   2 +-
 drivers/of/overlay.c                            |  15 +-
 drivers/of/unittest.c                           |  25 ++-
 drivers/power/supply/bq2415x_charger.c          |  16 +-
 drivers/power/supply/bq27xxx_battery_i2c.c      |  15 +-
 drivers/power/supply/ds2782_battery.c           |   9 +-
 drivers/powercap/powercap_sys.c                 |   8 +-
 drivers/pps/pps.c                               |  10 +-
 drivers/rapidio/rio_cm.c                        |  17 +-
 drivers/remoteproc/remoteproc_core.c            |   8 +-
 drivers/rpmsg/virtio_rpmsg_bus.c                |   8 +-
 drivers/scsi/bfa/bfad_im.c                      |   8 +-
 drivers/scsi/ch.c                               |   8 +-
 drivers/scsi/lpfc/lpfc_crtn.h                   |   2 +-
 drivers/scsi/lpfc/lpfc_init.c                   |  11 +-
 drivers/scsi/lpfc/lpfc_vport.c                  |   8 +-
 drivers/scsi/sg.c                               |  10 +-
 drivers/scsi/st.c                               |   8 +-
 drivers/staging/greybus/uart.c                  |  22 +--
 drivers/staging/unisys/visorhba/visorhba_main.c |   7 +-
 drivers/target/iscsi/iscsi_target.c             |   7 +-
 drivers/target/iscsi/iscsi_target_login.c       |   9 +-
 drivers/target/target_core_device.c             |   9 +-
 drivers/target/target_core_user.c               |  13 +-
 drivers/tee/tee_shm.c                           |   8 +-
 drivers/uio/uio.c                               |   9 +-
 drivers/usb/class/cdc-acm.c                     |  24 +--
 drivers/usb/core/devices.c                      |   2 +-
 drivers/usb/core/hcd.c                          |   7 +-
 drivers/usb/mon/mon_main.c                      |   3 +-
 drivers/usb/serial/usb-serial.c                 |  11 +-
 drivers/vfio/vfio.c                             |  15 +-
 fs/dlm/lock.c                                   |   9 +-
 fs/dlm/lockspace.c                              |   6 +-
 fs/dlm/recover.c                                |  10 +-
 fs/nfs/nfs4client.c                             |   9 +-
 fs/nfsd/nfs4state.c                             |   8 +-
 fs/notify/inotify/inotify_fsnotify.c            |   4 +-
 fs/notify/inotify/inotify_user.c                |   9 +-
 fs/ocfs2/cluster/tcp.c                          |  10 +-
 include/linux/idr.h                             |  26 +--
 include/linux/of.h                              |   4 +-
 include/linux/radix-tree.h                      |   2 +-
 include/net/9p/9p.h                             |   2 +-
 include/net/act_api.h                           |  76 +++-----
 ipc/msg.c                                       |   2 +-
 ipc/sem.c                                       |   2 +-
 ipc/shm.c                                       |   4 +-
 ipc/util.c                                      |  17 +-
 kernel/bpf/syscall.c                            |  20 +-
 kernel/cgroup/cgroup.c                          |  57 +++---
 kernel/events/core.c                            |  10 +-
 kernel/workqueue.c                              |  15 +-
 lib/idr.c                                       |  38 ++--
 lib/radix-tree.c                                |   5 +-
 mm/memcontrol.c                                 |  11 +-
 net/9p/client.c                                 |  17 +-
 net/9p/util.c                                   |  14 +-
 net/core/net_namespace.c                        |  23 ++-
 net/mac80211/cfg.c                              |  23 +--
 net/mac80211/iface.c                            |   3 +-
 net/mac80211/main.c                             |   2 +-
 net/mac80211/tx.c                               |   7 +-
 net/mac80211/util.c                             |   3 +-
 net/netlink/genetlink.c                         |  18 +-
 net/qrtr/qrtr.c                                 |  21 +-
 net/rxrpc/conn_client.c                         |  15 +-
 net/sched/act_api.c                             | 249 +++++++++++-------------
 net/sched/act_bpf.c                             |  17 +-
 net/sched/act_connmark.c                        |  16 +-
 net/sched/act_csum.c                            |  16 +-
 net/sched/act_gact.c                            |  16 +-
 net/sched/act_ife.c                             |  20 +-
 net/sched/act_ipt.c                             |  26 ++-
 net/sched/act_mirred.c                          |  19 +-
 net/sched/act_nat.c                             |  16 +-
 net/sched/act_pedit.c                           |  18 +-
 net/sched/act_police.c                          |  18 +-
 net/sched/act_sample.c                          |  17 +-
 net/sched/act_simple.c                          |  20 +-
 net/sched/act_skbedit.c                         |  18 +-
 net/sched/act_skbmod.c                          |  18 +-
 net/sched/act_tunnel_key.c                      |  20 +-
 net/sched/act_vlan.c                            |  22 +--
 net/sched/cls_flower.c                          |  55 +++---
 net/sctp/associola.c                            |   8 +-
 net/tipc/server.c                               |   7 +-
 172 files changed, 1256 insertions(+), 1113 deletions(-)

-- 
1.8.3.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2017-08-30 10:30 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28  6:41 [patch net-next 0/3] net/sched: Improve getting objects by indexes Chris Mi
2017-08-28  6:41 ` [patch net-next 1/3] idr: Add new APIs to support unsigned long Chris Mi
2017-08-29  7:14   ` Hannes Frederic Sowa
2017-08-29  7:34     ` Chris Mi
2017-08-29  7:57       ` Jiri Pirko
2017-08-29  8:00         ` Chris Mi
2017-08-29  7:56     ` Jiri Pirko
2017-08-28  6:41 ` [patch net-next 2/3] net/sched: Change cls_flower to use IDR Chris Mi
2017-08-28 11:37   ` Simon Horman
2017-08-29  3:25     ` Chris Mi
2017-08-30 10:30       ` Simon Horman
2017-08-28 21:55   ` Jamal Hadi Salim
2017-08-29  1:34     ` Chris Mi
2017-08-28  6:41 ` [patch net-next 3/3] net/sched: Change act_api and act_xxx modules " Chris Mi
2017-08-28 21:56   ` Jamal Hadi Salim
  -- strict thread matches above, loose matches on Subject: below --
2017-08-16  2:12 [patch net-next 0/3] net/sched: Improve getting objects by indexes Chris Mi
2017-08-16  2:12 Chris Mi
2017-08-16  2:12 ` Chris Mi
2017-08-16  2:12 ` Chris Mi
2017-08-16  2:12 ` Chris Mi
2017-08-16  3:05 ` David Miller
2017-08-16  3:38   ` Chris Mi
2017-08-16  7:49 ` Christian König
2017-08-16  7:49   ` Christian König
2017-08-16  7:49   ` Christian König
2017-08-16  7:49   ` Christian König
2017-08-16  8:16   ` Jiri Pirko
2017-08-16  8:31     ` Christian König
2017-08-16  8:39       ` Jiri Pirko
2017-08-16  8:55         ` Christian König
2017-08-16  9:31           ` Jiri Pirko
2017-08-16  9:41             ` Christian König
2017-08-16 14:28       ` David Laight
2017-08-16  9:19   ` Chris Wilson
2017-08-16  9:19   ` Chris Wilson
2017-08-16  9:19   ` Chris Wilson
2017-08-16  9:19     ` Chris Wilson
2017-08-16  9:19     ` Chris Wilson
2017-08-16  9:19     ` Chris Wilson
2017-08-16  9:19     ` Chris Wilson
2017-08-16  9:19     ` Chris Wilson
2017-08-16  9:19   ` Chris Wilson
2017-08-16  7:49 ` Christian König
2017-08-16  7:49 ` Christian König
2017-08-16  7:49 ` Christian König
2017-08-16 21:51 ` Frank Rowand
2017-08-16 21:51   ` Frank Rowand
2017-08-16  2:12 Chris Mi
2017-08-16  2:12 Chris Mi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.