From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752453AbcGMHyC (ORCPT ); Wed, 13 Jul 2016 03:54:02 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:36267 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752213AbcGMHxy (ORCPT ); Wed, 13 Jul 2016 03:53:54 -0400 Date: Wed, 13 Jul 2016 09:53:46 +0200 From: Michal Hocko To: Chen Gang Cc: Minchan Kim , akpm@linux-foundation.org, vbabka@suse.cz, mgorman@techsingularity.net, gi-oh.kim@profitbricks.com, iamjoonsoo.kim@lge.com, hillf.zj@alibaba-inc.com, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chen Gang Subject: Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Message-ID: <20160713075346.GC28723@dhcp22.suse.cz> References: <1468079704-5477-1-git-send-email-chengang@emindsoft.com.cn> <20160711002605.GD31817@bbox> <5783F7DE.9020203@emindsoft.com.cn> <20160712074841.GE14586@dhcp22.suse.cz> <57851FC4.4000000@emindsoft.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57851FC4.4000000@emindsoft.com.cn> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 13-07-16 00:50:12, Chen Gang wrote: > > > On 7/12/16 15:48, Michal Hocko wrote: > > On Tue 12-07-16 03:47:42, Chen Gang wrote: > > [...] > >> In our case, the 2 output size are same, but under x86_64, the insns are > >> different. After uses bool, it uses push/pop instead of branch, for me, > >> it should be a little better for catching. > > > > The code generated for bool version looks much worse. Look at the fast > > path. Gcc tries to reuse the retq from the fast path in the bool case > > and so it has to push rbp and rbx on the stack. > > > > That being said, gcc doesn't seem to generate a better code for bool so > > I do not think this is really worth it. > > > > The code below also merge 3 statements into 1 return statement, although > for me, it is a little more readable, it will generate a little bad code. > That is the reason why the output looks a little bad. > > In our case, for gcc 6.0, using bool instead of int for bool function > will get the same output under x86_64. If the output is same then there is no reason to change it. > In our case, for gcc 4.8, using bool instead of int for bool function > will get a little better output under x86_64. I had a different impression and the fast path code had more instructions. But anyway, is there really a strong reason to change those return values in the first place? Isn't that just a pointless code churn? -- Michal Hocko SUSE Labs