Thread (8 messages) 8 messages, 2 authors, 2018-03-27

Re: [PATCH]cgroup: __cpuset_node_allowed return bool

From: <hidden>
Date: 2018-03-26 14:42:02
Also in: lkml

Hi Tejun,

     Additionally,

On 2018-03-26 10:37 PM, yuankuiz@codeaurora.org wrote:
Hi Tejun,

    inline.

On 2018-03-26 10:25 PM, Tejun Heo wrote:
quoted
On Mon, Mar 26, 2018 at 10:20:43PM +0800, yuankuiz@codeaurora.org 
wrote:
quoted
 1) return int type variable in bool function:
 bool enabled()
 {
 	int ret = 1;
 	return ret;
 }
...
quoted
 2)
 bool enabled()
 {
 	bool ret = 1;
 	return ret;
 }
...
quoted
 so the #1) style function can generate significant instructions
than the #2).
That is a problem for the compiler, not the code.
[ZJ] Actually, it should be bool but not int. Without any optimization 
by compiler, it is the best if it is the same as returned.
quoted
quoted
 While, this is happened only when "-On" is not used with *-gcc
together. Though, it is oftern there, it is best to provide this
with decoupling of which option is used for optimization.
We don't want to dictate minute coding styles to avoid things which
are trivially optimized by compilers.
[ZJ] Optimized by compiler is observed only. Such as it is not so big
difference in x86-arch.
quoted
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
     Thanks,
BR//Zhao
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help