uipc_shm.c: make large page allocation interruptible

in cases there is no page pressure or when the user lost patience
waiting for very large allocation.  Other case is already handled by
vm_wait_intr().

Reported by:	"Lizzie from Eden Emulator project"
Reviewed by:	adrian, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56725
This commit is contained in:
Konstantin Belousov
2026-04-28 05:34:49 +03:00
parent 8f46ba0651
commit 839d3266d8
+8
View File
@@ -829,12 +829,20 @@ shm_dotruncate_largepage(struct shmfd *shmfd, off_t length, void *rl_cookie)
* object lock might allowed mapping of them.
*/
while (object->size < newobjsz) {
error = sig_intr();
if (error != 0)
return (error);
m = vm_page_alloc_contig(object, object->size, aflags,
pagesizes[psind] / PAGE_SIZE, 0, ~0,
pagesizes[psind], 0,
VM_MEMATTR_DEFAULT);
if (m == NULL) {
VM_OBJECT_WUNLOCK(object);
error = sig_intr();
if (error != 0) {
VM_OBJECT_WLOCK(object);
return (error);
}
if (shmfd->shm_lp_alloc_policy ==
SHM_LARGEPAGE_ALLOC_NOWAIT ||
(shmfd->shm_lp_alloc_policy ==