From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757279AbcLADSu (ORCPT ); Wed, 30 Nov 2016 22:18:50 -0500 Received: from out0-151.mail.aliyun.com ([140.205.0.151]:36875 "EHLO out0-151.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbcLADSs (ORCPT ); Wed, 30 Nov 2016 22:18:48 -0500 X-Greylist: delayed 438 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Nov 2016 22:18:47 EST X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R781e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03301;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---.7EuyCpF_1480561852; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "'Kirill A. Shutemov'" Cc: "'Theodore Ts'o'" , "'Andreas Dilger'" , "'Jan Kara'" , "'Andrew Morton'" , "'Alexander Viro'" , "'Hugh Dickins'" , "'Andrea Arcangeli'" , "'Dave Hansen'" , "'Vlastimil Babka'" , "'Matthew Wilcox'" , "'Ross Zwisler'" , , , , , , "'Naoya Horiguchi'" References: <20161129112304.90056-1-kirill.shutemov@linux.intel.com> <20161129112304.90056-23-kirill.shutemov@linux.intel.com> <017501d24aee$d9a189c0$8ce49d40$@alibaba-inc.com> <20161130131534.3k35cigsn36d7ku6@black.fi.intel.com> In-Reply-To: <20161130131534.3k35cigsn36d7ku6@black.fi.intel.com> Subject: Re: [PATCHv5 22/36] mm, hugetlb: switch hugetlbfs to multi-order radix-tree entries Date: Thu, 01 Dec 2016 11:10:52 +0800 Message-ID: <018c01d24b80$86b85490$9428fdb0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQNqqvX11++3/sbk46U0h1643++29gJ6BYz/Aa7r2DgCTrm7mp2N7M6Q Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, November 30, 2016 9:16 PM Kirill A. Shutemov wrote: > On Wed, Nov 30, 2016 at 05:48:05PM +0800, Hillf Danton wrote: > > On Tuesday, November 29, 2016 7:23 PM Kirill A. Shutemov wrote: > > > @@ -607,10 +605,10 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, > > > } > > > > > > /* Set numa allocation policy based on index */ > > > - hugetlb_set_vma_policy(&pseudo_vma, inode, index); > > > + hugetlb_set_vma_policy(&pseudo_vma, inode, index >> huge_page_order(h)); > > > > > > /* addr is the offset within the file (zero based) */ > > > - addr = index * hpage_size; > > > + addr = index << PAGE_SHIFT & ~huge_page_mask(h); > > > > > > /* mutex taken here, fault path and hole punch */ > > > hash = hugetlb_fault_mutex_hash(h, mm, &pseudo_vma, mapping, > > > > Seems we can't use index in computing hash as long as it isn't in huge page size. > > Look at changes in hugetlb_fault_mutex_hash(): we shift the index right by > huge_page_order(), before calculating the hash. I don't see a problem > here. > You are right. I missed that critical point. thanks Hillf