From: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, joe@perches.com,
peterz@infradead.org, mingo@kernel.org, tglx@linutronix.de
Subject: Re: [PATCH 01/15] sched/prio: Add a macro named NICE_TO_RLIMIT in prio.h.
Date: Tue, 11 Mar 2014 16:20:24 +0800 [thread overview]
Message-ID: <531EC748.5010600@cn.fujitsu.com> (raw)
In-Reply-To: <20140311081730.GA4298@osiris>
On 03/11/2014 04:17 PM, Heiko Carstens wrote:
> On Tue, Mar 11, 2014 at 12:59:16PM +0800, Dongsheng Yang wrote:
>> This patch add a macro named NICE_TO_RLIMIT in prio.h to
>> convert nice value [19,-20] to rlimit style value [1,40].
>>
>> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
>> ---
>> include/linux/sched/prio.h | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
>> index ac32258..8e78c47 100644
>> --- a/include/linux/sched/prio.h
>> +++ b/include/linux/sched/prio.h
>> @@ -41,4 +41,9 @@
>> #define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio)
>> #define MAX_USER_PRIO (USER_PRIO(MAX_PRIO))
>>
>> +/*
>> + * Convert nice value [19,-20] to rlimit style value [1,40].
>> + */
>> +#define NICE_TO_RLIMIT(nice) (MAX_NICE - nice + 1)
> Where is MAX_NICE defined? The s390 patch fails to compile.
MAX_NICE is defined in include/linux/sched/prio.h. It is applied in tip
tree,
and not in mainline yet.
>
> Also you probably want at least extra braces around the 'nice' usage to
> avoid subtle side effects. (or make NICE_TO.. a function, whatever).
Yes, agree. Another question is that I am not sure when I need to use a
macro
and when I should use a inline function.
Could you help to give me some sugguestion?
Thanx
>
next prev parent reply other threads:[~2014-03-11 8:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 4:59 [PATCH 00/15] A series patch for priority Dongsheng Yang
2014-03-11 4:59 ` [PATCH 01/15] sched/prio: Add a macro named NICE_TO_RLIMIT in prio.h Dongsheng Yang
2014-03-11 8:17 ` Heiko Carstens
2014-03-11 8:20 ` Dongsheng Yang [this message]
2014-03-11 8:36 ` Heiko Carstens
2014-03-11 8:44 ` Dongsheng Yang
2014-03-11 4:59 ` [PATCH 02/15] kernel/sys: Replace opened code implementation with NICE_TO_RLIMIT macro Dongsheng Yang
2014-03-11 4:59 ` [PATCH 03/15] workqueue: Replace hardcoding of -20 with MIN_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 04/15] locktorture: Replace hardcoding of 19 with MAX_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 05/15] tools/mq_perf_tests: Replace hardcoding of -20 with MIN_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 06/15] mm: Replace hardcoding of 19 with MAX_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 07/15] ioprio: Add a macro named NICE_TO_IOPRIO Dongsheng Yang
2014-03-11 4:59 ` [PATCH 08/15] fs/hearbeat: Replace hardcoding of -20 with MIN_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 09/15] driver/block: " Dongsheng Yang
2014-03-11 4:59 ` [PATCH 10/15] driver/char: Replace hardcoding of 19 with MAX_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 11/15] drivers/s390: " Dongsheng Yang
2014-03-11 4:59 ` [PATCH 12/15] driver/staging/android: Use RLIMIT_TO_NICE to replace opened code implementation Dongsheng Yang
2014-03-11 4:59 ` [PATCH 13/15] sched/prio: Add a macro named RLIMIT_TO_NICE in prio.h Dongsheng Yang
2014-03-11 4:59 ` [PATCH 14/15] driver/staging/lustre: Replace hardcoding of -20 with MIN_NICE Dongsheng Yang
2014-03-11 4:59 ` [PATCH 15/15] driver/scsi: Replace hardcoding of 20 " Dongsheng Yang
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=531EC748.5010600@cn.fujitsu.com \
--to=yangds.fnst@cn.fujitsu.com \
--cc=heiko.carstens@de.ibm.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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