From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Dongsheng Yang <yangds.fnst@cn.fujitsu.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 09:36:58 +0100 [thread overview]
Message-ID: <20140311083658.GB4298@osiris> (raw)
In-Reply-To: <531EC748.5010600@cn.fujitsu.com>
On Tue, Mar 11, 2014 at 04:20:24PM +0800, Dongsheng Yang wrote:
> On 03/11/2014 04:17 PM, Heiko Carstens wrote:
> >On Tue, Mar 11, 2014 at 12:59:16PM +0800, Dongsheng Yang wrote:
> >>+#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.
Ok.
> >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?
You can ask three people and get five opinions ;)
However if your above define would have been an inline function it
wouldn't suffer from possible subtle side effects and it would have
sane type checking etc. So usually functions should be preferred.
next prev parent reply other threads:[~2014-03-11 8:37 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
2014-03-11 8:36 ` Heiko Carstens [this message]
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=20140311083658.GB4298@osiris \
--to=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 \
--cc=yangds.fnst@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox