Message ID | 20241018011711.183642-1-jhubbard@nvidia.com (mailing list archive) |
---|---|
Headers | show |
Series | mm/gup: stop leaking pinned pages in low memory conditions | expand |
On Thu, 17 Oct 2024 18:17:09 -0700 John Hubbard <jhubbard@nvidia.com> wrote: I added cc:stable to both of these. Which might be inappropriate since "patch #2 is not really required". > mm/gup: stop leaking pinned pages in low memory conditions Fixes: 24a95998e9ba ("mm/gup.c: simplify and fix check_and_migrate_movable_pages() return codes") In mainline since v6.1! > mm/gup: memfd: stop leaking pinned pages in low memory conditions Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios") Since v6.11. So these are quite independent fixes. Kernels 6.1.x ... 6.10.x will have the first patch and not the second. That's presumably an untested combination, fingers crossed.
On 10/18/24 3:13 PM, Andrew Morton wrote: > On Thu, 17 Oct 2024 18:17:09 -0700 John Hubbard <jhubbard@nvidia.com> wrote: > > I added cc:stable to both of these. Which might be inappropriate since > "patch #2 is not really required". Right. > >> mm/gup: stop leaking pinned pages in low memory conditions > > Fixes: 24a95998e9ba ("mm/gup.c: simplify and fix check_and_migrate_movable_pages() return codes") > > In mainline since v6.1! > >> mm/gup: memfd: stop leaking pinned pages in low memory conditions > > Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios") > > Since v6.11. > > > So these are quite independent fixes. Kernels 6.1.x ... 6.10.x will > have the first patch and not the second. That's presumably an untested > combination, fingers crossed. > Probably fine. > Ah, I'm actually about to send out v3 in a moment, which only has one patch, whose diffs are just comment changes, plus David's latest suggestion: static long check_and_migrate_movable_pages(unsigned long nr_pages, struct page **pages) @@ -2437,8 +2440,10 @@ static long check_and_migrate_movable_pages(unsigned long nr_pages, long i, ret; folios = kmalloc_array(nr_pages, sizeof(*folios), GFP_KERNEL); - if (!folios) + if (!folios) { + unpin_user_pages(pages, nr_pages); return -ENOMEM; + } for (i = 0; i < nr_pages; i++) folios[i] = page_folio(pages[i]); thanks,