Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933709AbcK3Jzh (ORCPT ); Wed, 30 Nov 2016 04:55:37 -0500 Received: from out0-150.mail.aliyun.com ([140.205.0.150]:59621 "EHLO out0-150.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933442AbcK3JzG (ORCPT ); Wed, 30 Nov 2016 04:55:06 -0500 X-Greylist: delayed 373 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Nov 2016 04:54:59 EST X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03278;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---.7EoemRe_1480499285; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "'Kirill A. Shutemov'" , "'Theodore Ts'o'" , "'Andreas Dilger'" , "'Jan Kara'" , "'Andrew Morton'" Cc: "'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> In-Reply-To: <20161129112304.90056-23-kirill.shutemov@linux.intel.com> Subject: Re: [PATCHv5 22/36] mm, hugetlb: switch hugetlbfs to multi-order radix-tree entries Date: Wed, 30 Nov 2016 17:48:05 +0800 Message-ID: <017501d24aee$d9a189c0$8ce49d40$@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/nayzlNA= Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 716 Lines: 16 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.