1 SB-CPU-AFFINITY is a simple API to Linux scheduler affinity masks for
2 SBCL. See documentation of symbols exported from SB-CPU-AFFINITY
7 Nikodemus Siivola <nikodemus@random-state.net>
11 MIT-style. See file LICENSE for details.
15 Currently each call to GET-CPU-AFFINITY-MASK (and
16 WITH-CPU-AFFINITY-MASK) mallocs 128 bytes of memory for the
17 mask, which is never freed by the system -- at least not
18 on the Lisp side: freeing this memory causes glibc to complain
19 about a double-free, and breaks SBCL.
21 Patches and/or explantions for this welcome.
25 (asdf:oos 'asdf:load-op :sb-cpu-affinity)
27 (use-package :sb-cpu-affinity)
29 (with-cpu-affinity-mask (mask)
32 (with-cpu-affinity-mask (mask :save t)
34 (clear-cpu-affinity-mask mask)
36 (setf (cpu-affinity-p 0 mask) t))
38 (with-cpu-affinity-mask (mask)
41 (with-cpu-affinity-mask (mask :save t)
42 ;; Only odd CPUs in mask.
43 (dotimes (cpu (cpu-count))
44 (setf (cpu-affinity-p cpu mask) (oddp cpu))))
46 (with-cpu-affinity-mask (mask)