All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junyeong Jeong <esrse.jeong@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: /sys/devices/system/cpu/possible is immutable?
Date: Fri, 19 Mar 2021 00:45:07 +0900	[thread overview]
Message-ID: <877dm41n0k.fsf@gmail.com> (raw)
In-Reply-To: <YFNuuIOxA1CCY8Uq@kroah.com>


>
> That sysfs value itself will not change for the single system while the
> kernel is running, but your program could be moved from a system with
> one value for that file, to another system with a different value while
> it is running without knowing that you were migrated.
>

Running process migration to another system? Wow, I never knew that.
If migration happens between the time of reading
/sys/devices/system/cpu/possible and the time of calling
`bpf_lookup_elem`, TOCTOU(Time of check to Time of Use) problem would
arise. HaHa.

> So be careful here, and use the "normal" api to deal with cpu values and
> numbers, never assume that once you start, that the number of cpus your
> program has access to will not change.

Thank you Kroah-Hartman for your advice.

regards,
Junyeong

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2021-03-18 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 14:10 /sys/devices/system/cpu/possible is immutable? Junyeong Jeong
2021-03-18 15:16 ` Greg KH
2021-03-18 15:45   ` Junyeong Jeong [this message]

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=877dm41n0k.fsf@gmail.com \
    --to=esrse.jeong@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.