[PATCH xserver] dix: Bump MAXHASHSIZE for the resource db
Adam Jackson
ajax at redhat.com
Thu Sep 29 15:16:17 UTC 2016
From: Roberto Ragusa <mail at robertoragusa.it>
[This was originally a workaround for a client-side resource leak:
http://lists.freedesktop.org/archives/xorg-devel/2012-November/034555.html
Obviously that's a broken app, but the performance problem it
illustrates - that walking the linked list ends up burning all your CPU
time - is real enough. - ajax]
Reviewed-by: Adam Jackson <ajax at redhat.com>
---
dix/resource.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dix/resource.c b/dix/resource.c
index ad71b24..b054e0e 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -156,7 +156,7 @@ static void RebuildTable(int /*client */
#define INITBUCKETS 64
#define INITHASHSIZE 6
-#define MAXHASHSIZE 11
+#define MAXHASHSIZE 16
typedef struct _Resource {
struct _Resource *next;
@@ -683,6 +683,16 @@ HashResourceID(XID id, int numBits)
return ((int)(0x3FF & (id ^ (id>>10))));
case 11:
return ((int)(0x7FF & (id ^ (id>>11))));
+ case 12:
+ return ((int)(0xFFF & (id ^ (id>>12))));
+ case 13:
+ return ((int)(0x1FFF & (id ^ (id>>13))));
+ case 14:
+ return ((int)(0x3FFF & (id ^ (id>>14))));
+ case 15:
+ return ((int)(0x7FFF & (id ^ (id>>15))));
+ case 16:
+ return ((int)(0xFFFF & (id ^ (id>>16))));
}
if (numBits >= 11)
return ((int)(0x7FF & (id ^ (id>>11))));
--
2.9.3
More information about the xorg-devel
mailing list