Re: [PATCH v4 1/2] hugetlb: use f_mode & FMODE_HUGETLBFS to identify hugetlbfs files

From: Miklos Szeredi
Date: Mon Jun 15 2020 - 09:02:11 EST


On Mon, Jun 15, 2020 at 12:05 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>
> On Mon, Jun 15, 2020 at 10:53 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
> >
> > On Sat, Jun 13, 2020 at 9:12 PM Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:
> > >
> > > On 6/12/20 11:53 PM, Amir Goldstein wrote:
> >
> > > As a hugetlbfs developer, I do not know of a use case for interoperability
> > > with overlayfs. So yes, I am not too interested in making them work well
> > > together. However, if there was an actual use case I would be more than
> > > happy to consider doing the work. Just hate to put effort into fixing up
> > > two 'special' filesystems for functionality that may not be used.
> > >
> > > I can't speak for overlayfs developers.
> >
> > As I said, I only know of tmpfs being upper layer as a valid use case.
> > Does that work with hugepages? How would I go about testing that?
>
> Simple, after enabling CONFIG_HUGETLBFS:
>
> diff --git a/mount_union.py b/mount_union.py
> index fae8899..4070c70 100644
> --- a/mount_union.py
> +++ b/mount_union.py
> @@ -15,7 +15,7 @@ def mount_union(ctx):
> snapshot_mntroot = cfg.snapshot_mntroot()
> if cfg.should_mount_upper():
> system("mount " + upper_mntroot + " 2>/dev/null"
> - " || mount -t tmpfs upper_layer " + upper_mntroot)
> + " || mount -t hugetlbfs upper_layer " + upper_mntroot)
> layer_mntroot = upper_mntroot + "/" + ctx.curr_layer()
> upperdir = layer_mntroot + "/u"
> workdir = layer_mntroot + "/w"
>
> It fails colossally, because hugetlbfs, does not have write_iter().
> It is only meant as an interface to create named maps of huge pages.
> So I don't really see the use case for using it as upper.

Right.

I was actually asking about the tmpfs+hugepages, not the hugetlbfs case.

In the tmpfs case it looks like the lack of ->get_unmapped_area() in
overlayfs could still be an issue. But I'm not sure how to trigger
that.

Thanks,
Miklos