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:   Mon, 25 Jan 2021 14:34:37 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Alex Shi <alex.shi@...ux.alibaba.com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, Waiman Long <longman@...hat.com>
Subject: Re: [PATCH] mm/filemap: Adding missing mem_cgroup_uncharge() to
 __add_to_page_cache_locked()

Hi:
On 2021/1/25 12:36, Matthew Wilcox wrote:
> On Sun, Jan 24, 2021 at 11:24:41PM -0500, Waiman Long wrote:
>> diff --git a/mm/filemap.c b/mm/filemap.c
>> index 5c9d564317a5..aa0e0fb04670 100644
>> --- a/mm/filemap.c
>> +++ b/mm/filemap.c
>> @@ -835,6 +835,7 @@ noinline int __add_to_page_cache_locked(struct page *page,
>>  	XA_STATE(xas, &mapping->i_pages, offset);
>>  	int huge = PageHuge(page);
>>  	int error;
>> +	bool charged = false;
> 
> I don't think we need this extra bool.
> 
>> @@ -896,6 +898,8 @@ noinline int __add_to_page_cache_locked(struct page *page,
>>  
>>  	if (xas_error(&xas)) {
>>  		error = xas_error(&xas);
>> +		if (charged)
>> +			mem_cgroup_uncharge(page);
>>  		goto error;
>>  	}
> 
> Better:
> 
> -		goto error;
> +		goto uncharge;
> ...
> +uncharge:
> +	if (!huge)

Since commit 7a02fa97b897 ("secretmem: add memcg accounting"), this may be:
	if (!huge && !page_is_secretmem(page))
Or just bool charged is better?
Many thanks.
> +		mem_cgroup_uncharge(page);
>  error:
> ...
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ