From: Roberto Ragusa <m...@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 <a...@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

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to