Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp112853ybg; Thu, 11 Jun 2020 18:56:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFYj3vnzpWWkRIzObCdymoez3RtFWWDPqsJ+QZIX9Rrcng0VkJfA37Bpjh+WAlOdq8aX72 X-Received: by 2002:a17:906:1102:: with SMTP id h2mr9841509eja.356.1591926979649; Thu, 11 Jun 2020 18:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591926979; cv=none; d=google.com; s=arc-20160816; b=B3oLAVUabaRABUjq18uJVHwRKJ3NP8QJmet4vTZm+3hrHlho6MQSN3Ba5dnUBqvaBf YKgs2YOf4dXpgQqAe9ILFO5Nj/7egmCpk1TF6kVauKO8RBjkH3DR15qJ866FD3L8IJBi zhRFEoOupXHR2a+0ckdq8F8fp+cksjDPvLIZf2cUIEhYz4F6SpK/xCrmLqmFpu2AYXZ2 HTxzTEWVgvbwEB90oWf3H1AvMHWx7eAj8tCOtlGYYygZLazkmutbO8suCIDvIADASegy 61Qb9/i8W4gcWNqjynigUsCkKpR9RBwQLWKYIdowCSRE+NTVfEkN8w5CKJMDDQJ6x6sB FqUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cStLTJ8R6X6N3Wfmxkjdz1h2n4pTx9jO+4oGXH0Nk+U=; b=CRp6lZZTTcnEAUoKU2Q+D3XSW9wXb5VeKgXizjIk7tSeXRbiSxBJB3b9BXNeoxf8QM f8HOFb3f1UAN3NhWzbfc2RskTeevhWTG5/hoWYNOJvD9PovR/gpE/WF4yLpnB4/RRE5r 2Iu5jge83ZVIGz20TvSxpd1B+9ZRVdNZ1hszoHyoYdNkDkJyLL8DI/qX+OXeYN1RvtLf zNw5itWVRyDTcaCE2ro7jrdR/mVU/3+mT3Opv3hCrBPCIuDLKfITmstFjE3Met7ZPfj/ +nhXetdsj6Hsk9Ms/XLmTQYKRXb9oZO8+pBsoKNKH9DVESkaOD+OTJ+Q3f3cc0ROfWP5 4Qkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="PDm/mf4V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si3019267ejq.384.2020.06.11.18.55.57; Thu, 11 Jun 2020 18:56:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="PDm/mf4V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726588AbgFLBxf (ORCPT + 99 others); Thu, 11 Jun 2020 21:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbgFLBxe (ORCPT ); Thu, 11 Jun 2020 21:53:34 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 778FFC03E96F; Thu, 11 Jun 2020 18:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=cStLTJ8R6X6N3Wfmxkjdz1h2n4pTx9jO+4oGXH0Nk+U=; b=PDm/mf4V+mea+4FjDe9dRrySZm 1PQV3PkeeQydNP0pEbEeydYpOY6TBnb2aN5XtKW36ybqCahPFDrhLIL5/oWZUkM5bRvsJ1Ifi/or5 tRjIh2i9o8LjPat8GBLJCVjy+ZXRuXuVRQEApCSttRtSOkb4vn/HPp4qvsqxRlR/F3ecIywg7kqyF txNyAEzHkHeRDNdn8Cawq2zCu7aKl1akzpcC4Na5Hb1vFMhd8KYT2q3VT2KgEMFvntgbwR9njMPya 6k4fa/2vy1OZL+dcZR1YbRQ3rh1E1XN5Kk8SCNfSQXHbHkyYsjANp/wFk115nRsi2VRZE7HG7iUEW bssQishg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjYso-0006WI-Ve; Fri, 12 Jun 2020 01:53:26 +0000 Date: Thu, 11 Jun 2020 18:53:26 -0700 From: Matthew Wilcox To: Mike Kravetz Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, overlayfs , linux-kernel@vger.kernel.org, Al Viro , Miklos Szeredi , Colin Walters , Andrew Morton , syzbot , syzkaller-bugs Subject: Re: [PATCH v4 1/2] hugetlb: use f_mode & FMODE_HUGETLBFS to identify hugetlbfs files Message-ID: <20200612015326.GD8681@bombadil.infradead.org> References: <20200612004644.255692-1-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200612004644.255692-1-mike.kravetz@oracle.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 11, 2020 at 05:46:43PM -0700, Mike Kravetz wrote: > The routine is_file_hugepages() checks f_op == hugetlbfs_file_operations > to determine if the file resides in hugetlbfs. This is problematic when > the file is on a union or overlay. Instead, define a new file mode > FMODE_HUGETLBFS which is set when a hugetlbfs file is opened. The mode > can easily be copied to other 'files' derived from the original hugetlbfs > file. > > With this change hugetlbfs_file_operations can be static as it should be. > > There is also a (duplicate) set of shm file operations used for the routine > is_file_shm_hugepages(). Instead of setting/using special f_op's, just > propagate the FMODE_HUGETLBFS mode. This means is_file_shm_hugepages() and > the duplicate f_ops can be removed. > > While cleaning things up, change the name of is_file_hugepages() to > is_file_hugetlbfs(). The term hugepages is a bit ambiguous. I was going to have objections to this before I read it more carefully and realised that the "shm" here is sysvipc and doesn't have anything to do with the huge page support in shmfs. > A subsequent patch will propagate FMODE_HUGETLBFS in overlayfs. > > Suggested-by: Al Viro > Signed-off-by: Mike Kravetz Reviewed-by: Matthew Wilcox (Oracle) I might have suggested splitting the rename of is_file_hugetlbfs() from the rest of this patch, but I wouldn't resend to change that.