Re: [PATCH RFC 01/12] mm/hugetlb: Export hugetlbfs_pagecache_present()

Peter Xu
2023-11-23T16:06:57Z

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,

--
Peter Xu