Re: [RFC 08/10] Set PF_RECLAIMABLE_STACK in various places
From: K Prateek Nayak <kprateek.nayak@amd.com>
Date: 2026-08-28 06:34:38
Also in:
linux-mm, linux-rt-devel, lkml
Hello David, On 8/28/2026 4:59 AM, David Stevens wrote:
quoted hunk ↗ jump to hunk
@@ -469,16 +470,23 @@ anon_pipe_read(struct kiocb *iocb, struct iov_iter *to) break; } mutex_unlock(&pipe->mutex); - /* - * We only get here if we didn't actually read anything. - * - * But because we didn't read anything, at this point we can - * just return directly with -ERESTARTSYS if we're interrupted, - * since we've done any required wakeups and there's no need - * to mark anything accessed. And we've dropped the lock. - */ - if (wait_event_interruptible_exclusive(pipe->rd_wait, pipe_readable(pipe)) < 0) - return -ERESTARTSYS; + + { + guard(allow_stack_reclaim)();
nit. You can just use a
scoped_guard(allow_stack_reclaim) {
if (wait_event_interruptible_exclusive(...))
return -ERESTARTSYS;
}
here.
Same comment for rest of the thread where a scoped_guard() can be used
instead of this pattern.
+ /* + * We only get here if we didn't actually read + * anything. + * + * But because we didn't read anything, at this point + * we can just return directly with -ERESTARTSYS if + * we're interrupted, since we've done any required + * wakeups and there's no need to mark anything + * accessed. And we've dropped the lock. + */ + if (wait_event_interruptible_exclusive(pipe->rd_wait, + pipe_readable(pipe)) < 0) + return -ERESTARTSYS; + }
-- Thanks and Regards, Prateek