Re: [PATCH v7 5/7] mm: Make alloc_contig_range handle free hugetlb pages
From: Oscar Salvador
Date: Thu Apr 15 2021 - 04:28:34 EST
On Wed, Apr 14, 2021 at 02:26:21PM +0200, David Hildenbrand wrote:
> > +static inline int isolate_or_dissolve_huge_page(struct page *page)
> > +{
> > + return -ENOMEM;
>
> Without CONFIG_HUGETLB_PAGE, there is no way someone could possible pass in
> something valid. Although it doesn't matter too much, -EINVAL or similar
> sounds a bit better.
I guess we could, was just to make it consistent with the kind of error
we return when we have it enabled.
> > @@ -809,6 +809,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
> > bool skip_on_failure = false;
> > unsigned long next_skip_pfn = 0;
> > bool skip_updated = false;
> > + bool fatal_error = false;
>
> Can't we use "ret == -ENOMEM" instead of fatal_error?
Yes, we can, I will see how it looks.
[...]
> > + /*
> > + * Fence off gigantic pages as there is a cyclic dependency between
> > + * alloc_contig_range and them. Return -ENOME as this has the effect
>
> s/-ENOME/-ENOMEM/
thanks, I missed that one.
>
> > + * of bailing out right away without further retrying.
> > + */
> > + if (hstate_is_gigantic(h))
> > + return -ENOMEM;
> > +
> > + return alloc_and_dissolve_huge_page(h, head);
> > +}
> > +
> > struct page *alloc_huge_page(struct vm_area_struct *vma,
> > unsigned long addr, int avoid_reserve)
> > {
> >
>
> Complicated stuff, but looks good to me.
Thanks for having a look!
--
Oscar Salvador
SUSE L3