On 17.03.21 15:05, Michal Hocko wrote:
On Wed 17-03-21 12:12:47, Oscar Salvador wrote:
Currently, __alloc_contig_migrate_range can generate -EINTR, -ENOMEM or -EBUSY,
and report them down the chain.
The problem is that when migrate_pages() reports -ENOMEM, we keep going till we
exhaust all the try-attempts (5 at the moment) instead of bailing out.
migrate_pages() bails out right away on -ENOMEM because it is considered a fatal
error. Do the same here instead of keep going and retrying.
I suspect this is not really a real life problem, right? The allocation
would be more costly in the end but this is to be expected under a heavy
memory pressure.
That being said, bailing out early makes sense to me. But now that
you've made me look into the migrate_pages excellent error state reporting
I suspect we have a bug here. Note the
"Returns the number of pages that were not migrated, or an error code."
but I do not see putback_movable_pages for ret > 0 so it seems we might
leak some pages.
At least in __alloc_contig_migrate_range() we seem to always leave the
loop with ret <= 0 and do a putback_movable_pages() with ret < 0.
Which code are you referring to?
(I think the logic flow inside __alloc_contig_migrate_range() might be
improved ...)
--
Thanks,
David / dhildenb