diff --git a/mm/shmem.c b/mm/shmem.c index af21a89abb0f..3c0c7edd2020 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1742,6 +1742,10 @@ static int shmem_unuse_inode(struct inode *inode, unsigned int type) if (ret < 0) break; + if (signal_pending(current)) { + ret = -ERESTARTSYS; + break; + } start = indices[folio_batch_count(&fbatch) - 1]; } while (true); diff --git a/mm/swapfile.c b/mm/swapfile.c index 254ce86fa923..0f72a5b23a3a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2689,6 +2689,8 @@ static inline int unuse_pmd_range(struct vm_area_struct *vma, pud_t *pud, pmd = pmd_offset(pud, addr); do { cond_resched(); + if (signal_pending(current)) + return -ERESTARTSYS; next = pmd_addr_end(addr, end); ret = unuse_pte_range(vma, pmd, addr, next, type); if (ret) @@ -2922,7 +2924,7 @@ static int try_to_unuse(unsigned int type) if (swap_usage_in_pages(si)) { if (!signal_pending(current)) goto retry; - return -EINTR; + return -ERESTARTSYS; } success: