This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] |
Hi! On Tue, 06 Mar 2012 14:24:56 -0500 (EST), David Miller <davem@davemloft.net> wrote: > The NPTL sem_post code for sparc uses atomic_increment_val() but the return > value is unused. Simply use atomic_increment() and kill the unused local > variable. > > Committed to master. > > / > > * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c > (set_obp_int): New function. > (get_obp_int): New function. > (__get_clockfreq_via_dev_openprom): Likewise. > * sysdeps/unix/sysv/linux/sparc/sysdep.h (INTERNAL_SYSCALL_ERROR_P): Avoid > unused variable warnings on 'val' and use builtin_expect. > (INLINE_SYSCALL): Don't wrap INTERNAL_SYSCALL_ERROR_P with builtin_expect. > (INLINE_CLONE_SYSCALL): Likewise. > > nptl/ > > * sysdeps/unix/sysv/linux/sparc/sem_post.c (__new_sem_post): Use > atomic_increment and remove unused local variable. > (__old_sem_post): Likewise. Any reason not to commit the following on top of it? (David, ideally you could have done/proposed all of this.) So far, this is completely untested; all architectures that I'm readyily set up for testing have sem_post.S implementations (which I probably could temporarily remove to make the build use the generic sem_post.c file?). diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c b/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c index 3bf3371..b3dc4c4 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c @@ -1,5 +1,5 @@ /* sem_post -- post to a POSIX semaphore. Powerpc version. - Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003. @@ -54,11 +54,12 @@ attribute_compat_text_section __old_sem_post (sem_t *sem) { int *futex = (int *) sem; + int err; __asm __volatile (__lll_rel_instr ::: "memory"); - int nr = atomic_increment_val (futex); + atomic_increment (futex); /* We always have to assume it is a shared semaphore. */ - int err = lll_futex_wake (futex, 1, LLL_SHARED); + err = lll_futex_wake (futex, 1, LLL_SHARED); if (__builtin_expect (err, 0) < 0) { __set_errno (-err); diff --git a/nptl/sysdeps/unix/sysv/linux/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sem_post.c index 56f27e9..b21c24d 100644 --- a/nptl/sysdeps/unix/sysv/linux/sem_post.c +++ b/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -1,5 +1,5 @@ /* sem_post -- post to a POSIX semaphore. Generic futex-using version. - Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. @@ -64,10 +64,11 @@ attribute_compat_text_section __old_sem_post (sem_t *sem) { int *futex = (int *) sem; + int err; - int nr = atomic_increment_val (futex); + atomic_increment (futex); /* We always have to assume it is a shared semaphore. */ - int err = lll_futex_wake (futex, 1, LLL_SHARED); + err = lll_futex_wake (futex, 1, LLL_SHARED); if (__builtin_expect (err, 0) < 0) { __set_errno (-err); diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c index 2ffa31f..1a99de4 100644 --- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c +++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_post.c @@ -1,5 +1,5 @@ /* sem_post -- post to a POSIX semaphore. SPARC version. - Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. @@ -29,14 +29,13 @@ int __new_sem_post (sem_t *sem) { struct sparc_new_sem *isem = (struct sparc_new_sem *) sem; - int nr; if (__atomic_is_v9) - nr = atomic_increment_val (&isem->value); + atomic_increment (&isem->value); else { __sparc32_atomic_do_lock24 (&isem->lock); - nr = ++(isem->value); + ++(isem->value); __sparc32_atomic_do_unlock24 (&isem->lock); } atomic_full_barrier (); @@ -61,14 +60,13 @@ attribute_compat_text_section __old_sem_post (sem_t *sem) { struct sparc_old_sem *isem = (struct sparc_old_sem *) sem; - int nr; if (__atomic_is_v9) - nr = atomic_increment_val (&isem->value); + atomic_increment (&isem->value); else { __sparc32_atomic_do_lock24 (&isem->lock); - nr = ++(isem->value); + ++(isem->value); __sparc32_atomic_do_unlock24 (&isem->lock); } int err = lll_futex_wake (&isem->value, 1, Also these are missing from your commit: diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c b/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c index 28e06f6..6125811 100644 --- a/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c +++ b/nptl/sysdeps/unix/sysv/linux/sparc/sem_post.c @@ -1,5 +1,5 @@ /* sem_post -- post to a POSIX semaphore. SPARC version. - Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c index ba44a61..0638167 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c @@ -1,5 +1,5 @@ /* Get frequency of the system processor. sparc64 version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 30144b9..8b51fb8 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2003, 2004, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2000. GrÃÃe, Thomas
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |