Message ID | 20231116012908.392077-2-peterx@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2924146vqg; Wed, 15 Nov 2023 17:29:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2HzDgGOBECzKL3A2kXJ3SzuedTAKmTlcu3QzOrWgD9admUs/ENLiKdf3yYvAIPDaATofn X-Received: by 2002:a17:902:9304:b0:1cc:47e5:b4bf with SMTP id bc4-20020a170902930400b001cc47e5b4bfmr7254286plb.1.1700098172320; Wed, 15 Nov 2023 17:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700098172; cv=none; d=google.com; s=arc-20160816; b=pJb2fQVsY9TOsxiXAhyov/54fQavqSh1XTHFQg0+A6eXIaXqa2dlkeFTB3NPE7eF8N 5N62gu3bcrYbQS9tf+IgX4IEBHvKboLPwjZdIrdmCHTceo7QnV8KXlhs/tQvxB6/NBL6 S8Hvv9DZ41TMq4ItsOhUMfmWal+Pr4dy1HKHEWN1814dSiZtZEtR11C3QQ40+Rsl2fpi yk4hmB+cv892SXjk5HkFtzK/nMj2LukVr8sptg9nzZA1Kybl0yXRv9gRpogwMNyiVFD6 WziXme7qLiUDmYtqM8MegSSUrDvHDABy8iDqIjCADGavp5wo/A7LhH2JJg/0noJEP+xj FQ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j75oQuDXytIzx0fg9CVxcXlN+sYlHIe4GGC/3d4Gln4=; fh=o+FJD7UTEFgAOwGBZppViFyhRpBzPGRfoO/6xzRNnMs=; b=iIxw0wrEGCsjPNbG9KJ8AE+p1tWfn1J2WSL3+t6nMNtTKLXlGZngk2840slbjQxsn3 u9vHC73fD9bbs4rC7k6wDpZUif+NiN5lvOpxCRTif2DV5/EyCcszTB1UzX3Ui0Zk9Ryv S97mbMNfwjFebvwnwZwk2cHQKEWGwDF2asHbNGpIDQeSV5Mq+AaIMKA9w5fJR/z7EFxN Atl/J8Iufo7CCUOXoDK8nGb7HD8ZuLnedjeGNG0drfND6rNS0X0cL5IsksYzNDRQO/0e Sgc9jfMGgzuDWQhF30hhBR05jSykRKxccCkSNzLa/WNvrOBSOzciURsobB39hKwR4o5y ev1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ie72S6Vo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id jj2-20020a170903048200b001c9ad30e4b8si10560940plb.320.2023.11.15.17.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 17:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ie72S6Vo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 467EE80FDDD4; Wed, 15 Nov 2023 17:29:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344286AbjKPB3V (ORCPT <rfc822;lhua1029@gmail.com> + 28 others); Wed, 15 Nov 2023 20:29:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbjKPB3U (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Nov 2023 20:29:20 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40EF182 for <linux-kernel@vger.kernel.org>; Wed, 15 Nov 2023 17:29:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700098156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j75oQuDXytIzx0fg9CVxcXlN+sYlHIe4GGC/3d4Gln4=; b=Ie72S6VoYRKq1jIqB5k4Cg7EijAhC5kiEVGJJq6CW4edXDyTiofF9d7IVo7iaAL0p8csTV iCHLVk9yV4uFgp47JVd1Xk2fR1OtABnHnIhjQKjNP22ZkJQJc2kT+26RztJulSsk9rcwZ5 fvZYm5J7Zji6kKHgW1auw3r3X0Gnclg= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-644-vkNfz2qmMNeOn9C8UIiorA-1; Wed, 15 Nov 2023 20:29:13 -0500 X-MC-Unique: vkNfz2qmMNeOn9C8UIiorA-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-421ac2bad66so928371cf.0 for <linux-kernel@vger.kernel.org>; Wed, 15 Nov 2023 17:29:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700098153; x=1700702953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j75oQuDXytIzx0fg9CVxcXlN+sYlHIe4GGC/3d4Gln4=; b=PVzn/HDuUtlLokOzRb3Y8cG9XAgFaD7I8VXmxOtHjdyg2LzV7y8KHIlieYq+uTf/As GeioEoN+0GVkdIjzJCPH+/ldPqG+6SWDGDST8qYiFNoviggtdW2NpyfdOnHSTZ0V6AS3 Jy+E+Top5Ih+s02E6E2KDCp/WTFRqZIY0uznzu4UzH0NhaXSIJLMF4LVITzWDpT63rdI ZlcJ9IbnOYQRA81/OSKTsLynvqv4jCmp+dynlf3vqyKrgU7ukfgNw248YhwXt2UPq+k/ kfFV9K53XhXH2ZuMixVtlnrYQ6CVS8WBklVvmdd+1h7zcYC9F+r/sv90gsRy2mQZJ1jd JGEw== X-Gm-Message-State: AOJu0Yw4tHR5e3n7TBF4zkfoCW+8qqr3yaQALyxaIkoPAwGMYytZRhQO KYAwJhIV/1lJPb/W0GGiUDzwdhG1Mh6FAoPp2PJxEp4ZxVfx/emRYgATX8v7wmrHPyfHmSaolVR juMhA2N9G5oH27NgeA4YCcr8khYMUmUpK3lfRyHSJ0dnRiuicyaDJbHJ4Ox4U9D1RTElNKslFCo 4wwjd/2A== X-Received: by 2002:ac8:7d13:0:b0:41e:4be2:d3eb with SMTP id g19-20020ac87d13000000b0041e4be2d3ebmr10348628qtb.1.1700098153180; Wed, 15 Nov 2023 17:29:13 -0800 (PST) X-Received: by 2002:ac8:7d13:0:b0:41e:4be2:d3eb with SMTP id g19-20020ac87d13000000b0041e4be2d3ebmr10348586qtb.1.1700098152747; Wed, 15 Nov 2023 17:29:12 -0800 (PST) Received: from x1n.redhat.com (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id c24-20020ac85198000000b0041e383d527esm3922598qtn.66.2023.11.15.17.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 17:29:12 -0800 (PST) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Mike Kravetz <mike.kravetz@oracle.com>, "Kirill A . Shutemov" <kirill@shutemov.name>, Lorenzo Stoakes <lstoakes@gmail.com>, Axel Rasmussen <axelrasmussen@google.com>, Matthew Wilcox <willy@infradead.org>, John Hubbard <jhubbard@nvidia.com>, Mike Rapoport <rppt@kernel.org>, peterx@redhat.com, Hugh Dickins <hughd@google.com>, David Hildenbrand <david@redhat.com>, Andrea Arcangeli <aarcange@redhat.com>, Rik van Riel <riel@surriel.com>, James Houghton <jthoughton@google.com>, Yang Shi <shy828301@gmail.com>, Jason Gunthorpe <jgg@nvidia.com>, Vlastimil Babka <vbabka@suse.cz>, Andrew Morton <akpm@linux-foundation.org> Subject: [PATCH RFC 01/12] mm/hugetlb: Export hugetlbfs_pagecache_present() Date: Wed, 15 Nov 2023 20:28:57 -0500 Message-ID: <20231116012908.392077-2-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116012908.392077-1-peterx@redhat.com> References: <20231116012908.392077-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 17:29:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782682140926223685 X-GMAIL-MSGID: 1782682140926223685 |
Series |
mm/gup: Unify hugetlb, part 2
|
|
Commit Message
Peter Xu
Nov. 16, 2023, 1:28 a.m. UTC
It will be used outside hugetlb.c soon.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/linux/hugetlb.h | 3 +++
mm/hugetlb.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
Comments
You're (thankfully) not actually exporting anything, so please don't claim that in the subject. > pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, > unsigned long addr, pud_t *pud); > +bool hugetlbfs_pagecache_present(struct hstate *h, > + struct vm_area_struct *vma, > + unsigned long address); Can you just follow the much more readable two tab indent of the function above? > -static bool hugetlbfs_pagecache_present(struct hstate *h, > - struct vm_area_struct *vma, unsigned long address) > +bool hugetlbfs_pagecache_present(struct hstate *h, > + struct vm_area_struct *vma, unsigned long address) Same here. The new indentation not only is less readable but also creates a pointlessly overlong line.
On Wed, Nov 22, 2023 at 11:23:07PM -0800, Christoph Hellwig wrote: > You're (thankfully) not actually exporting anything, so please > don't claim that in the subject. Ah, I'll rename the subject to "mm/hugetlb: Declare hugetlbfs_pagecache_present() non-static". > > > pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, > > unsigned long addr, pud_t *pud); > > +bool hugetlbfs_pagecache_present(struct hstate *h, > > + struct vm_area_struct *vma, > > + unsigned long address); > > Can you just follow the much more readable two tab indent of the > function above? > > > -static bool hugetlbfs_pagecache_present(struct hstate *h, > > - struct vm_area_struct *vma, unsigned long address) > > +bool hugetlbfs_pagecache_present(struct hstate *h, > > + struct vm_area_struct *vma, unsigned long address) > > Same here. The new indentation not only is less readable but also > creates a pointlessly overlong line. I can easily follow what you suggest for this single patch, but afaict the kernel doesn't document that in the style guide. https://www.kernel.org/doc/html/v4.10/process/coding-style.html#functions And the reality is at least across mm codes it's used in a mixture of ways, even more than these two major forms of indentations. To be explicit, I think 2-tab is Vim's default, while this patch follows Emacs's c-mode default. It means if this patch indents wrongly, probably 99% of Emacs users are doomed. :( Before we have a clear and thorough rule over this, shall we just allow either sane indent to still be accepted? Or maybe there's some rule that I have missed? Personally I actually prefer Emacs's indentations to align with left bracket, but that's just subjective so doesn't count. Thanks,
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 236ec7b63c54..bb07279b8991 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -174,6 +174,9 @@ u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pud_t *pud); +bool hugetlbfs_pagecache_present(struct hstate *h, + struct vm_area_struct *vma, + unsigned long address); struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6feb3e0630d1..29705e5c6f40 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6018,8 +6018,8 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, /* * Return whether there is a pagecache page to back given address within VMA. */ -static bool hugetlbfs_pagecache_present(struct hstate *h, - struct vm_area_struct *vma, unsigned long address) +bool hugetlbfs_pagecache_present(struct hstate *h, + struct vm_area_struct *vma, unsigned long address) { struct address_space *mapping = vma->vm_file->f_mapping; pgoff_t idx = linear_page_index(vma, address);