History log of /freebsd-current/sys/sys/_bitset.h
Revision Date Author Comments
# 99adf661 09-May-2024 Elliott Mitchell <ehem+freebsd@m5p.com>

sys: declare bit sets unsigned

Substantially reduce the number of signed/unsigned issues (warnings if
enabled). While these are presently disabled for FreeBSD, being able to
enable another warning would be good.

Differential Revision: https://reviews.freebsd.org/D32793
Reviewed by: imp, jhibbits
Pull Request: https://github.com/freebsd/freebsd-src/pull/1126


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 49c2c628 08-Dec-2021 Stefan Eßer <se@FreeBSD.org>

sys/_bitset.h: Fix fall-out from commit 5e04571cf3c

The changes to the bitset macros allowed sched.h to be included
into userland programs without name space pollution due to BIT_*
and BITSET_* macros.

The definition of a "struct bitset" had been overlooked. This name
space pollution caused the build of port print/miktex to fail.

This commit makes the definition of struct bitset depend on the
same condition as the visibility of the BIT_* and BITSET_* macros,
i.e. needs _KERNEL or _WANT_FREEBSD_BITSET to be defined before
including sys/_bitset.h.

It has been tested with "make universe" since a prior attempt to
fix the issue broke the PowerPC64 kernel build.

This commit shall be MFCed together with commit 5e04571cf3c.

Reported by: arrowd
MFC after: 1 month


# e9aeb507 07-Dec-2021 Stefan Eßer <se@FreeBSD.org>

sys/_bitset.h: revert commit 74e014dbfab

It caused kernel build for PowerPC64 to fail.

A different patch is being tested with make universe to make sure it
works on all architectures.

MFC after: 1 month<N [day[s]|week[s]|month[s]]. Request a reminder email>


# 74e014db 07-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

sys/_bitset.h: Fix fall-out from commit 5e04571cf3c

The changes to the bitset macros allowed sched.h to be included into
userland programs without name space pollution due to BIT_* and
BITSET_* macros.

The definition of a global variable "bitset" had been overlooked.
This name space pollution caused a compile failure in print/miktex.

This commit renames the bitset variable to __bitset with the same
mapping back to the bitset if _KERNEL or _WANT_FREEBSD_BITSET is
defined.

This fix has been suggested by kib. It has been tested to let the
build of the print/miktex port succeed and to not break buildworld.

This commit shall be MFCed together with commit 5e04571cf3c.

Reported by: arrowd
MFC after: 1 month


# 5e04571c 05-Dec-2021 Stefan Eßer <se@FreeBSD.org>

sys/bitset.h: reduce visibility of BIT_* macros

Add two underscore characters "__" to names of BIT_* and BITSET_*
macros to move them to the implementation name space and to prevent
a name space pollution due to BIT_* macros in 3rd party programs with
conflicting parameter signatures.

These prefixed macro names are used in kernel header files to define
macros in e.g. sched.h, sys/cpuset.h and sys/domainset.h.

If C programs are built with either -D_KERNEL (automatically passed
when building a kernel or kernel modules) or -D_WANT_FREENBSD_BITSET
(or this macros is defined in the source code before including the
bitset macros), then all macros are made visible with their previous
names, too. E.g., both __BIT_SET() and BIT_SET() are visible with
either of _KERNEL or _WANT_FREEBSD_BITSET defined.

The main reason for this change is that some 3rd party sources
including sched.h have been found to contain conflicting BIT_*
macros.

As a work-around, parts of shed.h have been made conditional and
depend on _WITH_CPU_SET_T being set when sched.h is included.
Ports that expect the full functionality provided by sched.h need
to be built with -D_WITH_CPU_SET_T. But this leads to conflicts if
BIT_* macros are defined in that program, too.

This patch set makes all of sched.h visible again without this
parameter being passed and without any name space pollution due
to BIT_* macros becoming visible when sched.h is included.

This patch set will be backported to the STABLE branches, but ports
will need to use -D_WITH_CPU_SET_T as long as there are supported
releases that do not contain these patches.

Reviewed by: kib, markj
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D33235


# e5818a53 28-Mar-2018 Jeff Roberson <jeff@FreeBSD.org>

Implement several enhancements to NUMA policies.

Add a new "interleave" allocation policy which stripes pages across
domains with a stride or width keeping contiguity within a multi-page
region.

Move the kernel to the dedicated numbered cpuset #2 making it possible
to assign kernel threads and memory policy separately from user. This
also eliminates the need for the complicated interrupt binding code.

Add a sysctl API for viewing and manipulating domainsets. Refactor some
of the cpuset_t manipulation code using the generic bitset type so that
it can be used for both. This probably belongs in a dedicated subr file.

Attempt to improve the include situation.

Reviewed by: kib
Discussed with: jhb (cpuset parts)
Tested by: pho (before review feedback)
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14839


# c4e20cad 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 03f5b58d 06-May-2016 Roger Pau Monné <royger@FreeBSD.org>

bitset: introduce helpers to allocate a bitset at runtime

Introduce some new helpers to declare and allocate a dynamic bitset, whose
size is not a constant.

Sponsored by: Citrix Systems R&D
Reviewed by: kib jhb
Differential revision: https://reviews.freebsd.org/D6226


# f8e81aa5 05-May-2016 John Baldwin <jhb@FreeBSD.org>

Fix <sys/_bitset.h> and <sys/_cpuset.h> to not require <sys/param.h>.

- Hardcode '8' instead of NBBY in _BITSET_BITS.
- Define a private version of 'howmany' for use in __bitset_words().
- While here, move a few more things out of _bitset.h and _cpuset.h to
bitset.h and cpuset.h, respectively. The only things left in
_bitset.h and _cpuset.h are the bits needed to define a bitset
structure.

Reviewed by: bde, kib (ish)


# c8fc1264 23-Oct-2015 Mark Johnston <markj@FreeBSD.org>

Remove an erroneous semicolon.

MFC after: 3 days


# 75363312 08-May-2013 Attilio Rao <attilio@FreeBSD.org>

Generalize the bitset operations, present in cpuset and offer a KPI to
redefine such operations for different consumers.
This will be used when NUMA support will be finished and numaset
will need to be used.

Sponsored by: EMC / Isilon storage division
Obtained from: jeff
Reviewed by: alc