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, 15 May 2015 14:37:15 +0200
From:	Vlastimil Babka <vbabka@...e.cz>
To:	"Kirill A. Shutemov" <kirill@...temov.name>
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>, Rik van Riel <riel@...hat.com>,
	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>,
	Jerome Marchand <jmarchan@...hat.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv5 01/28] mm, proc: adjust PSS calculation

On 05/15/2015 01:43 PM, Kirill A. Shutemov wrote:
> On Fri, May 15, 2015 at 01:33:31PM +0200, Vlastimil Babka wrote:
>> On 05/15/2015 12:56 PM, Kirill A. Shutemov wrote:
>>> On Thu, May 14, 2015 at 04:12:29PM +0200, Vlastimil Babka wrote:
>>>> On 04/23/2015 11:03 PM, Kirill A. Shutemov wrote:
>>>>> With new refcounting all subpages of the compound page are not nessessary
>>>>> have the same mapcount. We need to take into account mapcount of every
>>>>> sub-page.
>>>>>
>>>>> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
>>>>> Tested-by: Sasha Levin <sasha.levin@...cle.com>
>>>>
>>>> Acked-by: Vlastimil Babka <vbabka@...e.cz>
>>>>
>>>> (some nitpicks below)
>>>>
>>>>> ---
>>>>>   fs/proc/task_mmu.c | 43 ++++++++++++++++++++++---------------------
>>>>>   1 file changed, 22 insertions(+), 21 deletions(-)
>>>>>
>>>>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>>>>> index 956b75d61809..95bc384ee3f7 100644
>>>>> --- a/fs/proc/task_mmu.c
>>>>> +++ b/fs/proc/task_mmu.c
>>>>> @@ -449,9 +449,10 @@ struct mem_size_stats {
>>>>>   };
>>>>>
>>>>>   static void smaps_account(struct mem_size_stats *mss, struct page *page,
>>>>> -		unsigned long size, bool young, bool dirty)
>>>>> +		bool compound, bool young, bool dirty)
>>>>>   {
>>>>> -	int mapcount;
>>>>> +	int i, nr = compound ? hpage_nr_pages(page) : 1;
>>>>
>>>> Why not just HPAGE_PMD_NR instead of hpage_nr_pages(page)?
>>>
>>> Okay, makes sense. Compiler is smart enough to optimize away HPAGE_PMD_NR
>>> for THP=n. (HPAGE_PMD_NR is BUILD_BUG() for THP=n)
>>
>> Ah, BUILD_BUG()... I'm not sure we can rely on optimization to avoid
>> BUILD_BUG(), what if somebody compiles with all optimizations off?
>
> Kernel relies on dead-code elimination. You cannot build kernel with -O0.

Ah, OK.

>> So why not replace BUILD_BUG() with "1", or create a variant of HPAGE_PMD_NR
>> that does that, for this case and patch 3. Seems better than testing
>> PageTransHuge everywhere...
>
> I think we could try to downgrade it BUG(). Although I found BUILD_BUG()
> useful few times.

BUILD_BUG() seems like a better match here. Better than pollute the code 
for THP=n (in case of Patch 3 where it doesn't eliminate).

> HPAGE_PMD_NR==1 would be just wrong. It would mean you can map order-0
> page with PMD %-|

That's why I suggested a different variant of the "variable".
--
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