STACK_HASH_SEED);
 }
 
+/* Use our own, non-instrumented version of memcmp().
+ *
+ * We actually don't care about the order, just the equality.
+ */
+static inline
+int stackdepot_memcmp(const unsigned long *u1, const unsigned long *u2,
+                       unsigned int n)
+{
+       for ( ; n-- ; u1++, u2++) {
+               if (*u1 != *u2)
+                       return 1;
+       }
+       return 0;
+}
+
 /* Find a stack that is equal to the one stored in entries in the hash */
 static inline struct stack_record *find_stack(struct stack_record *bucket,
                                             unsigned long *entries, int size,
        for (found = bucket; found; found = found->next) {
                if (found->hash == hash &&
                    found->size == size &&
-                   !memcmp(entries, found->entries,
-                           size * sizeof(unsigned long))) {
+                   !stackdepot_memcmp(entries, found->entries, size))
                        return found;
-               }
        }
        return NULL;
 }