lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 20 Feb 2015 18:39:46 +0100
From:	Jerome Marchand <jmarchan@...hat.com>
To:	"Kirill A. Shutemov" <kirill@...temov.name>,
	Rik van Riel <riel@...hat.com>
CC:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	Dave Hansen <dave.hansen@...el.com>,
	Mel Gorman <mgorman@...e.de>, Vlastimil Babka <vbabka@...e.cz>,
	Christoph Lameter <cl@...two.org>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Steve Capper <steve.capper@...aro.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Michal Hocko <mhocko@...e.cz>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: [PATCHv3 04/24] rmap: add argument to charge compound page

On 02/16/2015 04:20 PM, Kirill A. Shutemov wrote:
> On Thu, Feb 12, 2015 at 04:10:21PM -0500, Rik van Riel wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 02/12/2015 11:18 AM, Kirill A. Shutemov wrote:
>>
>>> +++ b/include/linux/rmap.h @@ -168,16 +168,24 @@ static inline void
>>> anon_vma_merge(struct vm_area_struct *vma,
>>>
>>> struct anon_vma *page_get_anon_vma(struct page *page);
>>>
>>> +/* flags for do_page_add_anon_rmap() */ +enum { +	RMAP_EXCLUSIVE =
>>> 1, +	RMAP_COMPOUND = 2, +};
>>
>> Always a good idea to name things. However, "exclusive" is
>> not that clear to me. Given that the argument is supposed
>> to indicate whether we map a single or a compound page,
>> maybe the names in the enum could just be SINGLE and COMPOUND?
>>
>> Naming the enum should make it clear enough what it does:
>>
>>  enum rmap_page {
>>       SINGLE = 0,
>>       COMPOUND
>>  }
> 
> Okay, this is probably confusing: do_page_add_anon_rmap() already had one
> of arguments called 'exclusive'. It indicates if the page is exclusively
> owned by the current process. And I needed also to indicate if we need to
> handle the page as a compound or not. I've reused the same argument and
> converted it to set bit-flags: bit 0 is exclusive, bit 1 - compound.

AFAICT, this is not a common use of enum and probably the reason why Rik
was confused (I know I find it confusing). Bit-flags members are usually
define by macros.

Jerome
> 
>>
>>> +++ b/kernel/events/uprobes.c @@ -183,7 +183,7 @@ static int
>>> __replace_page(struct vm_area_struct *vma, unsigned long addr, goto
>>> unlock;
>>>
>>> get_page(kpage); -	page_add_new_anon_rmap(kpage, vma, addr); +
>>> page_add_new_anon_rmap(kpage, vma, addr, false); 
>>> mem_cgroup_commit_charge(kpage, memcg, false); 
>>> lru_cache_add_active_or_unevictable(kpage, vma);
>>
>> Would it make sense to use the name in the argument to that function,
>> too?
>>
>> I often find it a lot easier to see what things do if they use symbolic
>> names, rather than by trying to remember what each boolean argument to
>> a function does.
> 
> I can convert these compound booleans to enums if you want. I'm personally
> not sure that if will bring much value.
> 



Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists