Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1442133
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable |
| Date | 2016-07-13 10:00 +0200 |
| Message-ID | <rUnfj-8tL-7@gated-at.bofh.it> (permalink) |
| References | <rT2Zj-5gh-3@gated-at.bofh.it> <rTxgJ-84p-5@gated-at.bofh.it> <rTPnj-30E-1@gated-at.bofh.it> <rU0C6-1W7-3@gated-at.bofh.it> <rU92G-7wG-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Minchan Kim <minchan@kernel.org> - 2016-07-11 02:30 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Chen Gang <chengang@emindsoft.com.cn> - 2016-07-11 21:50 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Vlastimil Babka <vbabka@suse.cz> - 2016-07-12 09:20 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Chen Gang <chengang@emindsoft.com.cn> - 2016-07-12 18:40 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Michal Hocko <mhocko@kernel.org> - 2016-07-12 09:50 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Chen Gang <chengang@emindsoft.com.cn> - 2016-07-12 18:50 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Michal Hocko <mhocko@kernel.org> - 2016-07-13 10:00 +0200
Re: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Chen Gang <chengang@emindsoft.com.cn> - 2016-07-17 03:00 +0200
csiph-web