public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Haifeng Xu <haifeng.xu@shopee.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] ht_affinity.c: fix ht_affinity test failure
Date: Fri, 20 Sep 2024 14:22:50 +0200	[thread overview]
Message-ID: <Zu1pGq6bklSY3SSZ@yuki.lan> (raw)
In-Reply-To: <82a1294f-f15a-4c1b-aee7-703e4ff84120@shopee.com>

Hi!
> From the kernel source code, the user_mask_ptr is unsigned long.
> 
> SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
> 		unsigned long __user *, user_mask_ptr)
> 
> so maybe we can keep the type of user_mask_ptr consistent with it.

It's actually accessed as an array. See get_user_cpu_mask() function just
above this syscall definition and userspace is suppose to pass an array
big enough for all the flags of CPUs it cares about.

There are also macros in the libc sched.h header that allows you to
allocate an array big enough for the current machine and manipulate the
bits, see man CPU_ALLOC.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-09-20 12:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20  8:30 [LTP] [PATCH] ht_affinity.c: fix ht_affinity test failure Haifeng Xu via ltp
2024-09-20  8:58 ` Cyril Hrubis
2024-09-20 10:52   ` Haifeng Xu via ltp
2024-09-20 12:22     ` Cyril Hrubis [this message]
2024-09-21  4:17       ` Haifeng Xu via ltp
2024-09-21  4:38       ` [LTP] [PATCH v2] " Haifeng Xu via ltp
2024-09-23 12:25         ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zu1pGq6bklSY3SSZ@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=haifeng.xu@shopee.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox