LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: pierre.peiffer@bull.net
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.24-mm1 1/8] (resend) IPC/semaphores: code factorisation
Date: Wed, 13 Feb 2008 23:07:02 +0300	[thread overview]
Message-ID: <20080213200702.GE2144@martell.zuzino.mipt.ru> (raw)
In-Reply-To: <20080212162720.306787485@bull.net>

On Tue, Feb 12, 2008 at 05:13:41PM +0100, pierre.peiffer@bull.net wrote:
> Trivial patch which adds some small locking functions and makes use of them
> to factorize some part of the code and to make it cleaner.

What's wrong with consolidation activity in general is that one need to
follow tags many times to realise what on earth function really does.

> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -180,6 +180,25 @@ static inline struct sem_array *sem_lock
>  	return container_of(ipcp, struct sem_array, sem_perm);
>  }
>  
> +static inline void sem_lock_and_putref(struct sem_array *sma)
> +{
> +	ipc_lock_by_ptr(&sma->sem_perm);
> +	ipc_rcu_putref(sma);
> +}
> +
> +static inline void sem_getref_and_unlock(struct sem_array *sma)
> +{
> +	ipc_rcu_getref(sma);
> +	ipc_unlock(&(sma)->sem_perm);
> +}
> +
> +static inline void sem_putref(struct sem_array *sma)
> +{

It should be called sem_lock_putref_and_unlock() at which point it
becomes obvious that this patch is from useless-wrappers land.

> +	ipc_lock_by_ptr(&sma->sem_perm);
> +	ipc_rcu_putref(sma);
> +	ipc_unlock(&(sma)->sem_perm);

On the other hand PUT is associated with atomic_dec_and_test() which
does no locking itself.

  reply	other threads:[~2008-02-13 20:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12 16:13 [PATCH 2.6.24-mm1 0/8] (resend) IPC: code rewrite pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 1/8] (resend) IPC/semaphores: code factorisation pierre.peiffer
2008-02-13 20:07   ` Alexey Dobriyan [this message]
2008-02-13 21:31     ` Pierre PEIFFER
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 2/8] (resend) IPC/shared memory: introduce shmctl_down pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 3/8] (resend) IPC/message queues: introduce msgctl_down pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 4/8] (resend) IPC/semaphores: move the rwmutex handling inside semctl_down pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 5/8] (resend) IPC/semaphores: remove one unused parameter from semctl_down() pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 6/8] (resend) IPC: get rid of the use *_setbuf structure pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 7/8] (resend) IPC: introduce ipc_update_perm() pierre.peiffer
2008-02-12 16:13 ` [PATCH 2.6.24-mm1 8/8] (resend) IPC: consolidate all xxxctl_down() functions pierre.peiffer
2008-03-05  0:03   ` Randy Dunlap
2008-02-15 11:19 ` [PATCH 2.6.24-mm1 0/8] (resend) IPC: code rewrite Andi Kleen
2008-02-15 12:37   ` Pierre Peiffer

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=20080213200702.GE2144@martell.zuzino.mipt.ru \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre.peiffer@bull.net \
    --subject='Re: [PATCH 2.6.24-mm1 1/8] (resend) IPC/semaphores: code factorisation' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).