This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

performance problems with linuxthreads on arm


Dear all,
I am using glibc-2.3.4 with linuxthreads (pthread library) for an application (running on an armv4 processor). Under certain conditions I had massive performance problems. The cpu load was < 10 %, but the handling of a message through some threads and due to locking costs up to 10 seconds instead of expected ~10 ms. I broke the problem down to the point, that I had exact the problem described here:


http://lists.arm.linux.org.uk/pipermail/linux-arm/2002-June/003710.html

I tested now solution 1, which is to take compare_and_swap from the glibc, and put it into linuxthreads too. This cured the problem on first sight.

But since my knowledge about possible implications is very limited (and I fear, that this is a very bad idea), it would be nice, if someone has a comment or alternative.

Here the used function:
PT_EI int
__compare_and_swap (long int *p, long int oldval, long int newval)
{
  int result, tmp;
  __asm__ ("\n"
       "0:\tldr\t%1,[%2]\n\t"
       "mov\t%0,#0\n\t"
       "cmp\t%1,%4\n\t"
       "bne\t1f\n\t"
       "swp\t%0,%3,[%2]\n\t"
       "cmp\t%1,%0\n\t"
       "swpne\t%1,%0,[%2]\n\t"
       "bne\t0b\n\t"
       "mov\t%0,#1\n"
       "1:"
       : "=&r" (result), "=&r" (tmp)
       : "r" (p), "r" (newval), "r" (oldval)
       : "cc", "memory");
  return result;
}

Best regards
Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]