All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Rik van Riel <riel@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>,
	David Howells <dhowells@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][1/2] fix for -mm add-sem_is_read-write_locked.patch
Date: Mon, 05 Sep 2005 10:48:43 +0100	[thread overview]
Message-ID: <26510.1125913723@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.63.0509031134240.567@cuia.boston.redhat.com>

Rik van Riel <riel@redhat.com> wrote:

> Here is an incremental fix to the add-sem_is_read-write_locked
> patch in -mm.  Also attached is a full version of that file,
> which can just be dropped into place - I've verified that none
> of the patches in your stack get rejects.

The comment attached to the drop-in replacement patch is wrong:

| [1. text/plain; add-sem_is_read-write_locked.patch]   
| 
| From: Rik Van Riel <riel@redhat.com>
| 
| Add sem_is_read/write_locked functions to the read/write semaphores, along the
| same lines of the *_is_locked spinlock functions.  The swap token tuning patch
| uses sem_is_read_locked; sem_is_write_locked is added for completeness.

The function names you've used are incorrect.

Furthermore, the substance of the patch is wrong in a number of ways:

| Index: linux-2.6.13/include/asm-ppc64/rwsem.h
| ===================================================================
| --- linux-2.6.13.orig/include/asm-ppc64/rwsem.h
| +++ linux-2.6.13/include/asm-ppc64/rwsem.h
| @@ -163,5 +163,10 @@ static inline int rwsem_atomic_update(in
|  	return atomic_add_return(delta, (atomic_t *)(&sem->count));
|  }
|  
| +static inline int sem_is_read_locked(struct rw_semaphore *sem)
| +{
| +	return (sem->count != 0);
| +}
| +

This uses the function wrong name. And:

| Index: linux-2.6.13/include/linux/rwsem-spinlock.h
| ===================================================================
| --- linux-2.6.13.orig/include/linux/rwsem-spinlock.h
| +++ linux-2.6.13/include/linux/rwsem-spinlock.h
| @@ -61,5 +61,15 @@ extern void FASTCALL(__up_read(struct rw
|  extern void FASTCALL(__up_write(struct rw_semaphore *sem));
|  extern void FASTCALL(__downgrade_write(struct rw_semaphore *sem));
|  
| +static inline int sem_is_read_locked(struct rw_semaphore *sem)
| +{
| +	return (sem->activity > 0);
| +}
| +
| +static inline int sem_is_write_locked(struct rw_semaphore *sem)
| +{
| +	return (sem->activity < 0);
| +}
| +

Is inconsistent, though the tests are valid.

Also, you don't need to bracket the expression handed to the return directive,
but that's a minor matter.

David

  reply	other threads:[~2005-09-05  9:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-03 15:37 [PATCH][1/2] fix for -mm add-sem_is_read-write_locked.patch Rik van Riel
2005-09-05  9:48 ` David Howells [this message]
2005-09-05 13:42   ` Rik van Riel
2005-09-05 13:47   ` Rik van Riel
2005-09-05 14:14     ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26510.1125913723@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.