From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756826AbcK3NQU (ORCPT ); Wed, 30 Nov 2016 08:16:20 -0500 Received: from mga11.intel.com ([192.55.52.93]:48122 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbcK3NQL (ORCPT ); Wed, 30 Nov 2016 08:16:11 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,574,1473145200"; d="scan'208";a="11587028" Date: Wed, 30 Nov 2016 16:15:34 +0300 From: "Kirill A. Shutemov" To: Hillf Danton Cc: "'Theodore Ts'o'" , "'Andreas Dilger'" , "'Jan Kara'" , "'Andrew Morton'" , "'Alexander Viro'" , "'Hugh Dickins'" , "'Andrea Arcangeli'" , "'Dave Hansen'" , "'Vlastimil Babka'" , "'Matthew Wilcox'" , "'Ross Zwisler'" , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, "'Naoya Horiguchi'" Subject: Re: [PATCHv5 22/36] mm, hugetlb: switch hugetlbfs to multi-order radix-tree entries Message-ID: <20161130131534.3k35cigsn36d7ku6@black.fi.intel.com> References: <20161129112304.90056-1-kirill.shutemov@linux.intel.com> <20161129112304.90056-23-kirill.shutemov@linux.intel.com> <017501d24aee$d9a189c0$8ce49d40$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <017501d24aee$d9a189c0$8ce49d40$@alibaba-inc.com> User-Agent: NeoMutt/20160916 (1.7.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Kirill A. Shutemov