Re: [PATCH v2 3/7] mm/gup: Fix the outdated code comments above get_user_pages_unlocked()

From: David Hildenbrand
Date: Tue Apr 01 2025 - 04:14:54 EST


On 31.03.25 10:13, Baoquan He wrote:
Since commit f0818f472d8d ("mm: gup: add get_user_pages_locked
and get_user_pages_unlocked"), get_user_pages() doesn't need to have
mmap_lock held anymore. It calls __get_user_pages_locked() which
can acquire and drop the mmap_lock internaly.

s/internaly/internally/

But your statement is wrong. get_user_pages() must be called with the mmap_lock held, because it sets "int locked = 1;" when calling __get_user_pages_locked().

--
Cheers,

David / dhildenb