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:	Wed, 28 Mar 2012 23:08:34 +0530
From:	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To:	Michal Hocko <mhocko@...e.cz>
Cc:	linux-mm@...ck.org, mgorman@...e.de,
	kamezawa.hiroyu@...fujitsu.com, dhillf@...il.com,
	aarcange@...hat.com, akpm@...ux-foundation.org, hannes@...xchg.org,
	linux-kernel@...r.kernel.org, cgroups@...r.kernel.org
Subject: Re: [PATCH -V4 08/10] hugetlbfs: Add a list for tracking in-use HugeTLB pages

Michal Hocko <mhocko@...e.cz> writes:

> On Fri 16-03-12 23:09:28, Aneesh Kumar K.V wrote:
>> From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
>> 
>> hugepage_activelist will be used to track currently used HugeTLB pages.
>> We need to find the in-use HugeTLB pages to support memcg removal.
>> On memcg removal we update the page's memory cgroup to point to
>> parent cgroup.
>> 
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
>> ---
>>  include/linux/hugetlb.h |    1 +
>>  mm/hugetlb.c            |   23 ++++++++++++++++++-----
>>  2 files changed, 19 insertions(+), 5 deletions(-)
>> 
>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index cbd8dc5..6919100 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
> [...]
>> @@ -2319,14 +2322,24 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
>>  		page = pte_page(pte);
>>  		if (pte_dirty(pte))
>>  			set_page_dirty(page);
>> -		list_add(&page->lru, &page_list);
>> +
>> +		spin_lock(&hugetlb_lock);
>> +		list_move(&page->lru, &page_list);
>> +		spin_unlock(&hugetlb_lock);
>
> Why do we really need the spinlock here?


It does a list_del from hugepage_activelist.


>
>>  	}
>>  	spin_unlock(&mm->page_table_lock);
>>  	flush_tlb_range(vma, start, end);
>>  	mmu_notifier_invalidate_range_end(mm, start, end);
>>  	list_for_each_entry_safe(page, tmp, &page_list, lru) {
>>  		page_remove_rmap(page);
>> -		list_del(&page->lru);
>> +		/*
>> +		 * We need to move it back huge page active list. If we are
>> +		 * holding the last reference, below put_page will move it
>> +		 * back to free list.
>> +		 */
>> +		spin_lock(&hugetlb_lock);
>> +		list_move(&page->lru, &h->hugepage_activelist);
>> +		spin_unlock(&hugetlb_lock);
>
> This spinlock usage doesn't look nice but I guess we do not have many
> other options.
>

-aneesh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ