From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760047Ab3DBDid (ORCPT ); Mon, 1 Apr 2013 23:38:33 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:12670 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1759535Ab3DBDic (ORCPT ); Mon, 1 Apr 2013 23:38:32 -0400 X-IronPort-AV: E=Sophos;i="4.87,391,1363104000"; d="scan'208";a="6987181" Message-ID: <515A5329.6020805@cn.fujitsu.com> Date: Tue, 02 Apr 2013 11:40:25 +0800 From: Lin Feng User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Zhouping Liu CC: David Rientjes , Andrea Arcangeli , Hugh Dickins , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Amos Kong Subject: Re: THP: AnonHugePages in /proc/[pid]/smaps is correct or not? References: <383590596.664138.1364803227470.JavaMail.root@redhat.com> <515A4BD1.1020407@redhat.com> In-Reply-To: <515A4BD1.1020407@redhat.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/04/02 11:37:30, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/04/02 11:37:31, Serialize complete at 2013/04/02 11:37:31 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zhouping, On 04/02/2013 11:09 AM, Zhouping Liu wrote: > I don't understand clearly the last sentence 'you'll probably only get 100% hugepages only 1/512th of the time.' > could you please explain more details about 'only 1/512th of the time'? IIUC, thp size is 2M so it may be comprised of 512 normal page(size 4k). Since your test code is not 2M aligned(not using posix_memalign()) so the start address of the mapped vma will be random, such as 2M*i+4k*1, 2M*i+4k*2...2M*i+k4*511, there is 512 possibilities. The only chance you get thp happens when the first map just starts at 2M*i, and the consequent maps also benefit from this. -------- snip -------- > > so, again, if I understand correctly, thp should tune the naturally aligned maps, such as generated by mmap()/malloc(), > make such maps 'hugepagesize' aligned if the maps or vma is equal and greater than 'hugepagesize', doesn't it? We may gain performance improving from this. thanks, linfeng From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx195.postini.com [74.125.245.195]) by kanga.kvack.org (Postfix) with SMTP id F0F976B0002 for ; Mon, 1 Apr 2013 23:38:34 -0400 (EDT) Message-ID: <515A5329.6020805@cn.fujitsu.com> Date: Tue, 02 Apr 2013 11:40:25 +0800 From: Lin Feng MIME-Version: 1.0 Subject: Re: THP: AnonHugePages in /proc/[pid]/smaps is correct or not? References: <383590596.664138.1364803227470.JavaMail.root@redhat.com> <515A4BD1.1020407@redhat.com> In-Reply-To: <515A4BD1.1020407@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Sender: owner-linux-mm@kvack.org List-ID: To: Zhouping Liu Cc: David Rientjes , Andrea Arcangeli , Hugh Dickins , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Amos Kong Hi Zhouping, On 04/02/2013 11:09 AM, Zhouping Liu wrote: > I don't understand clearly the last sentence 'you'll probably only get 100% hugepages only 1/512th of the time.' > could you please explain more details about 'only 1/512th of the time'? IIUC, thp size is 2M so it may be comprised of 512 normal page(size 4k). Since your test code is not 2M aligned(not using posix_memalign()) so the start address of the mapped vma will be random, such as 2M*i+4k*1, 2M*i+4k*2...2M*i+k4*511, there is 512 possibilities. The only chance you get thp happens when the first map just starts at 2M*i, and the consequent maps also benefit from this. -------- snip -------- > > so, again, if I understand correctly, thp should tune the naturally aligned maps, such as generated by mmap()/malloc(), > make such maps 'hugepagesize' aligned if the maps or vma is equal and greater than 'hugepagesize', doesn't it? We may gain performance improving from this. thanks, linfeng -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org