From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Andi Kleen <andi@firstfloor.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] RWSEM: Rewrite rwsem.c and rwsem-spinlock.c more simply.
Date: Tue, 25 Mar 2008 08:27:35 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.1.00.0803250813190.19386@localhost.localdomain> (raw)
In-Reply-To: <87skyfgg4y.fsf@basil.nowhere.org>
On Tue, 25 Mar 2008, Andi Kleen wrote:
> "Robert P. J. Day" <rpjday@crashcourse.ca> writes:
>
> > Rewrite these source files more simply by deleting the superfluous
> > "tsk" task_struct pointer and rephrasing in terms of the "current"
> > task pointer.
>
> This is likely a code pessimization because "current" is inline
> assembler and many gcc versions cannot CSE it.
i'm not sure what this means -- which of the transformations in that
patch is considered unsafe? here's a typical simplification:
- tsk = current;
- set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+ set_current_state(TASK_UNINTERRUPTIBLE);
there's all sorts of usage of set_current_state() throughout the
tree. how is simplifying the code in these two files in exactly the
same way any different? or am i missing something because this
involves semaphores?
rday
p.s. given this bit from sched.h:
...
#define __set_task_state(tsk, state_value) \
do { (tsk)->state = (state_value); } while (0)
#define set_task_state(tsk, state_value) \
set_mb((tsk)->state, (state_value))
...
#define __set_current_state(state_value) \
do { current->state = (state_value); } while (0)
#define set_current_state(state_value) \
set_mb(current->state, (state_value))
...
it's not clear why set_current_state() and __current_state() are
defined the way they are when it would seem to be simpler (and less
error-prone) to just write:
#define __set_current_state(sv) __set_task_state(current, sv)
#define set_current_state(sv) set_task_state(current, sv)
the law of parsimony and all that. or, once again, is there
something subtle i'm not seeing?
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
========================================================================
next prev parent reply other threads:[~2008-03-25 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-25 11:02 Robert P. J. Day
2008-03-25 12:08 ` Andi Kleen
2008-03-25 12:27 ` Robert P. J. Day [this message]
2008-03-25 12:36 ` Andi Kleen
2008-03-25 12:42 ` Robert P. J. Day
2008-03-25 19:14 ` Andrew Morton
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=alpine.LFD.1.00.0803250813190.19386@localhost.localdomain \
--to=rpjday@crashcourse.ca \
--cc=akpm@osdl.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome