Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020AbbFKWqS (ORCPT ); Thu, 11 Jun 2015 18:46:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55774 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534AbbFKWqP (ORCPT ); Thu, 11 Jun 2015 18:46:15 -0400 Message-ID: <1434062766.3165.103.camel@stgolabs.net> Subject: Re: [RFC v4 PATCH 2/9] mm/hugetlb: expose hugetlb fault mutex for use by fallocate From: Davidlohr Bueso To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , Naoya Horiguchi , David Rientjes , Hugh Dickins , Aneesh Kumar , Hillf Danton , Christoph Hellwig Date: Thu, 11 Jun 2015 15:46:06 -0700 In-Reply-To: <1434056500-2434-3-git-send-email-mike.kravetz@oracle.com> References: <1434056500-2434-1-git-send-email-mike.kravetz@oracle.com> <1434056500-2434-3-git-send-email-mike.kravetz@oracle.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1527 Lines: 39 On Thu, 2015-06-11 at 14:01 -0700, Mike Kravetz wrote: > /* Forward declaration */ > static int hugetlb_acct_memory(struct hstate *h, long delta); > @@ -3324,7 +3324,8 @@ static u32 fault_mutex_hash(struct hstate *h, struct mm_struct *mm, > unsigned long key[2]; > u32 hash; > > - if (vma->vm_flags & VM_SHARED) { > + /* !vma implies this was called from hugetlbfs fallocate code */ > + if (!vma || vma->vm_flags & VM_SHARED) { That !vma is icky, and really no need for it: hugetlbfs_fallocate(), for example, already passes [pseudo]vma->vm_flags with VM_SHARED, and you say it yourself in the comment. Do you see any reason why we cannot just keep the vma->vm_flags & VM_SHARED check? > +/* > + * Interface for use by hugetlbfs fallocate code. Faults must be > + * synchronized with page adds or deletes by fallocate. fallocate > + * only deals with shared mappings. See also hugetlb_fault_mutex_lock > + * and hugetlb_fault_mutex_unlock. > + */ > +u32 hugetlb_fault_mutex_shared_hash(struct address_space *mapping, pgoff_t idx) > +{ > + return fault_mutex_hash(NULL, NULL, NULL, mapping, idx, 0); > +} It strikes me that this too should be static inlined. But I really dislike the nil params thing, which should be addressed by my comment above. Thanks, Davidlohr -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/