Date: Sat, 15 Feb 2014 06:30:38 +0400 From: Andrey Chernov <ache@freebsd.org> To: Andriy Gapon <avg@freebsd.org>, John Baldwin <jhb@freebsd.org>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org> Subject: Re: can the scheduler decide to schedule an interrupted but runnable thread on another CPU core? What are the implications for code? Message-ID: <52FED14E.50304@freebsd.org> In-Reply-To: <20140215001100.GS34851@funkthat.com> References: <CAJ-Vmo=7Nz1jqXy%2BrTQ7u9_ZP7jeFOKUJxU1O51tYJjvTUmWTg@mail.gmail.com> <201402141318.44743.jhb@freebsd.org> <52FE5FBF.3090104@freebsd.org> <201402141410.29325.jhb@freebsd.org> <52FE93E6.6030705@freebsd.org> <52FE9A5E.5050300@freebsd.org> <52FEADC9.2040608@FreeBSD.org> <20140215001100.GS34851@funkthat.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 15.02.2014 4:11, John-Mark Gurney wrote: >>> This is code example from cpuminer port, in case you are interested, it is very simple: >>> >>> static inline void affine_to_cpu(int id, int cpu) >>> { >>> cpuset_t set; >>> CPU_ZERO(&set); >>> CPU_SET(cpu, &set); >>> cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_CPUSET, -1, sizeof(cpuset_t), &set); >> >> I think that CPU_WHICH_TID should have been used here. > > I agree... cpuset(2): > The which argument determines how the value of id is interpreted and is > of type cpuwhich_t. The which argument may have the following values: > > CPU_WHICH_TID id is lwpid_t (thread id) > CPU_WHICH_PID id is pid_t (process id) > CPU_WHICH_CPUSET id is a cpusetid_t (cpuset id) > CPU_WHICH_IRQ id is an irq number > > An id of '-1' may be used with a which of CPU_WHICH_TID, CPU_WHICH_PID, > or CPU_WHICH_CPUSET to mean the current thread, process, or current > thread's cpuset. All cpuset syscalls allow this usage. The question still remains: why SCHED_ULE and SCHED_4BSD do different things here on CPU_WHICH_CPUSET == -1 (current thread's cpuset)? It looks like SCHED_ULE changes per/process mask while SCHED_4BSD change per/thread mask in that case. -- http://ache.vniz.net/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52FED14E.50304>