Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752097AbdCSQFG (ORCPT ); Sun, 19 Mar 2017 12:05:06 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34594 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751475AbdCSQFF (ORCPT ); Sun, 19 Mar 2017 12:05:05 -0400 Date: Mon, 20 Mar 2017 00:05:01 +0800 From: Wei Yang To: Michal Hocko Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: use BITS_PER_LONG to unify the definition in page->flags Message-ID: <20170319160501.GB1187@WeideMBP.lan> Reply-To: Wei Yang References: <20170318003914.24839-1-richard.weiyang@gmail.com> <20170319143012.GB12414@dhcp22.suse.cz> <20170319150345.GA34657@WeideMacBook-Pro.local> <20170319150822.GC12414@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bCsyhTFzCvuiizWE" Content-Disposition: inline In-Reply-To: <20170319150822.GC12414@dhcp22.suse.cz> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3105 Lines: 94 --bCsyhTFzCvuiizWE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 19, 2017 at 11:08:22AM -0400, Michal Hocko wrote: >On Sun 19-03-17 23:03:45, Wei Yang wrote: >> On Sun, Mar 19, 2017 at 10:30:13AM -0400, Michal Hocko wrote: >> >On Sat 18-03-17 08:39:14, Wei Yang wrote: >> >> The field page->flags is defined as unsigned long and is divided into >> >> several parts to store different information of the page, like sectio= n, >> >> node, zone. Which means all parts must sit in the one "unsigned >> >> long". >> >>=20 >> >> BITS_PER_LONG is used in several places to ensure this applies. >> >>=20 >> >> #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_P= AGEFLAGS >> >> #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <=3D BITS_PER_LONG - N= R_PAGEFLAGS >> >> #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <=3D= BITS_PER_LONG - NR_PAGEFLAGS >> >>=20 >> >> While we use "sizeof(unsigned long) * 8" in the definition of >> >> SECTIONS_PGOFF >> >>=20 >> >> #define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTI= ONS_WIDTH) >> >>=20 >> >> This may not be that obvious for audience to catch the point. >> >>=20 >> >> This patch replaces the "sizeof(unsigned long) * 8" with BITS_PER_LON= G to >> >> make all this consistent. >> > >> >I am not really sure this is an improvement. page::flags is unsigned >> >long nad the current code reflects that type. >> > >>=20 >> Hi, Michal >>=20 >> Glad to hear from you. >>=20 >> I think the purpose of definition BITS_PER_LONG is more easily to let au= dience >> know it is the number of bits of type long. If it has no improvement, we= don't >> need to define a specific macro . >>=20 >> And as you could see, several related macros use BITS_PER_LONG in their >> definition. After this change, all of them will have a consistent defini= tion. >>=20 >> After this change, code looks more neat :-) >>=20 >> So it looks more reasonable to use this. > >I do not think that this is sufficient to justify the change. > Fine~ Thanks for comments~ >--=20 >Michal Hocko >SUSE Labs --=20 Wei Yang Help you, Help me --bCsyhTFzCvuiizWE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIbBAEBCAAGBQJYzqwtAAoJEKcLNpZP5cTdphwP9juG3BaAYBNgXUHSNQuUA6KL LgvM9Nn5I9OeB5VM8RjS3u+DsLmo7GwY7U54qDrQFHB3ek2/4mYF35hNbpO/gDS9 n8RRYytWDvlSKxzcjeRVKIrBOwVPlKtBhy2rxTsIOr9vchBSwdxvu6PkC0Y9TIiy PZOQrAuEgkqkHpLOedvsMdfsZimJgj4Pstgs0rRhKNDGQs5q5eIQlVzCMhZZE1Km GluKeCAxNlhWxKSODhH91IBD1Jk8mefhFrVtK+KzAoEM/hz6yjiknY+mwJnterJ/ vnQYlra8LLqjaQG+/nEJ1iCG2rurUYP+uoxVnH0gee1mbHHiQuRblSxnXbabX2JQ yXaYt+tqpbVkDqHZZbgzGdmoipYjkO2ffiIYG5kLgtV0iNapV9waNt+05l+oUeKY yBW7dfJPmhqpNbUZ2OUhhw01gMkcOacGlmLJf3q4TCMpOuMJji+J64HNoaFraNBA rFrzB3tQArAcOgT+BUgJqxebk93T7ajAH481JS81qSSqiEqXOuLiPUzZz2eLY0Pn 9YZ+tGuSciElI/cHykCLBtAjwn6GWGewjhcjCjd5cv9BAxKPj+vCYjpXlxMxWbio E2spDvrR6HQkj+RpMESmYNBH6aH1DiDFWaq4QrgAlbfmjNPSctLJb1+Qdc279m9e J0msXEDGvYyHl5lQstM= =C5Ko -----END PGP SIGNATURE----- --bCsyhTFzCvuiizWE--