diff mbox series

[v2,5/6] io_uring/waitid: use io_is_compat()

Message ID 28c5b5f1f1bf7f4d18869dafe6e4147ce1bbf0f5.1740400452.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series compile out ctx->compat reads | expand

Commit Message

Pavel Begunkov Feb. 24, 2025, 12:42 p.m. UTC
Use io_is_compat() for consistency.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/waitid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anuj gupta Feb. 24, 2025, 1:23 p.m. UTC | #1
Looks good:
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Caleb Sander Mateos Feb. 24, 2025, 3:33 p.m. UTC | #2
On Mon, Feb 24, 2025 at 4:48 AM Pavel Begunkov <asml.silence@gmail.com> wrote:
>
> Use io_is_compat() for consistency.
>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
>  io_uring/waitid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/waitid.c b/io_uring/waitid.c
> index 347b8f53efa7..4034b7e3026f 100644
> --- a/io_uring/waitid.c
> +++ b/io_uring/waitid.c
> @@ -78,7 +78,7 @@ static bool io_waitid_copy_si(struct io_kiocb *req, int signo)
>                 return true;
>
>  #ifdef CONFIG_COMPAT
> -       if (req->ctx->compat)
> +       if (io_is_compat(req->ctx))
>                 return io_waitid_compat_copy_si(iw, signo);
>  #endif

Would it be possible to remove the #ifdef CONFIG_COMPAT here (and
around io_waitid_compat_copy_si()), like you did in rw.c? The compiler
should be able to optimize out the if (false) and the unused static
function. Same comment for the remaining uses of #ifdef CONFIG_COMPAT
in net.c.

Best,
Caleb


>
> --
> 2.48.1
>
>
Pavel Begunkov Feb. 24, 2025, 4:12 p.m. UTC | #3
On 2/24/25 15:33, Caleb Sander Mateos wrote:
> On Mon, Feb 24, 2025 at 4:48 AM Pavel Begunkov <asml.silence@gmail.com> wrote:
>>
>> Use io_is_compat() for consistency.
>>
>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>> ---
>>   io_uring/waitid.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/io_uring/waitid.c b/io_uring/waitid.c
>> index 347b8f53efa7..4034b7e3026f 100644
>> --- a/io_uring/waitid.c
>> +++ b/io_uring/waitid.c
>> @@ -78,7 +78,7 @@ static bool io_waitid_copy_si(struct io_kiocb *req, int signo)
>>                  return true;
>>
>>   #ifdef CONFIG_COMPAT
>> -       if (req->ctx->compat)
>> +       if (io_is_compat(req->ctx))
>>                  return io_waitid_compat_copy_si(iw, signo);
>>   #endif
> 
> Would it be possible to remove the #ifdef CONFIG_COMPAT here (and
> around io_waitid_compat_copy_si()), like you did in rw.c? The compiler
> should be able to optimize out the if (false) and the unused static
> function. Same comment for the remaining uses of #ifdef CONFIG_COMPAT
> in net.c.

Likely so, I hinted on the same in the cv as well, but it doesn't
have to happen in a single set. If anything, I'd prefer to flush this
now, so that the dependency is merged and everything else can
be done independently.
diff mbox series

Patch

diff --git a/io_uring/waitid.c b/io_uring/waitid.c
index 347b8f53efa7..4034b7e3026f 100644
--- a/io_uring/waitid.c
+++ b/io_uring/waitid.c
@@ -78,7 +78,7 @@  static bool io_waitid_copy_si(struct io_kiocb *req, int signo)
 		return true;
 
 #ifdef CONFIG_COMPAT
-	if (req->ctx->compat)
+	if (io_is_compat(req->ctx))
 		return io_waitid_compat_copy_si(iw, signo);
 #endif