[PATCH 0/1] mm/cma: fix alloc_contig_range ret code/potential leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In an attempt to make contiguous allocation routines more available to
drivers, I have been experimenting with code similar to that used by
alloc_gigantic_page().  While stressing this code with many other
allocations and frees in progress, I would sometimes notice large 'leaks'
of page ranges.

I traced this down to the routine alloc_contig_range() itself.  In commit
8ef5849fa8a2 the code was changed so that an -EBUSY returned by
__alloc_contig_migrate_range() would not immediately return to the caller.
Rather, processing continues so that test_pages_isolated() is eventually
called.  This is done because test_pages_isolated() has a tracepoint to
identify the busy pages.

However, it is possible (observed in my testing) that pages which were
busy when __alloc_contig_migrate_range was called may become available
by the time test_pages_isolated is called.  Further, it is possible that
the entire range can actually be allocated.  Unfortunately, in this case
the return code originally set by __alloc_contig_migrate_range (-EBUSY)
is returned to the calller.  Therefore, the caller assumes the range was
not allocated and the pages are essentially leaked.

The following patch simply updates the return code based on the value
returned from test_pages_isolated.

It is unlikely that we will hit this issue today based on the limited
number of callers to alloc_contig_range.  However, I have Cc'ed stable
because if we do hit this issue it has the potential to leak a large
number of pages.

Mike Kravetz (1):
  mm/cma: fix alloc_contig_range ret code/potential leak

 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.13.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux