LLVM/project 2fd8d41llvm/lib/Target/X86 X86ISelDAGToDAG.cpp, llvm/test/CodeGen/X86 pr216504.ll

[X86] Don't fold loads from non-fixed stack objects into tail calls (#221243)

Fixes #216504

The callee of a tail call can be folded into the jump as a memory
operand (`TCRETURNmi64`). That jump runs after the epilogue, so the
operand is resolved relative to the incoming stack pointer, which only
works for fixed objects such as incoming arguments. Here the callee was
a `volatile` local, so the load stayed on the stack and got folded,
while a variable-index extract from a 256-bit vector went through a
32-byte stack temporary and forced dynamic realignment. Once the stack
is realigned a local has no static offset from the incoming stack
pointer, and PEI tripped the assertion. The sibcall eligibility check
does look at realignment, but it runs before legalization, so it never
saw the temporary. Spill slots created during register allocation can
cause the same thing, so no check at that point can be complete.

The fold is now refused whenever the load's address may use a non-fixed
frame index, in `checkTCRetEnoughRegs`, which gates both the

    [5 lines not shown]
DeltaFile
+57-0llvm/test/CodeGen/X86/pr216504.ll
+34-4llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+91-42 files

LLVM/project 1448940clang/utils/TableGen CIRLoweringEmitter.cpp

[CIR] Derive lowering attr names from cppClassName, not the def name

CIRLoweringEmitter built its CXX_ABI_ALWAYS_LEGAL_ATTRS entries with
GetOpCppClassName, which splits the TableGen def name at the first
underscore. That works only while every def is named CIR_<CppClassName>Attr.
When one is not, the emitter writes an `isa<>` for a class that does not
exist, and the failure lands as a compile error in generated code.

Attributes carry the authoritative name in cppClassName, which
GenerateAttrToValueVisitor was already reading. Factor that out as
GetAttrCppClassRef and use it for both attribute paths. GetOpCppClassName
stays for operations.

NFC, and checkable. No CIR attribute overrides cppClassName, so the generated
CIRLowering.inc is byte-identical.
DeltaFile
+16-10clang/utils/TableGen/CIRLoweringEmitter.cpp
+16-101 files

LLVM/project 13f5805clang/include/clang/CIR/Dialect/IR CIROps.td

[CIR] Migrate the FPClassTest bit enum and unquote its flags

cir.is_fp_class printed its flags inconsistently. Single-bit values came out
bare, as in `fcSNan`, while group values and combinations came out quoted, as
in `"fcInf"` and `"fcSNan|fcNegInf"`. That comes from I32BitEnumAttr setting
printBitEnumQuoted, which EnumAttr.td keeps only for backwards compatibility.

Clearing the bit and using the `enum` directive selects the separator-aware
parser and printer, so every value now spells unquoted:

  cir.is_fp_class %x, fcSNan|fcNegInf : (!cir.float) -> !cir.bool

The enum also drops its specialized IntegerAttr for a CIR_EnumAttr wrapper,
giving it the standalone spelling `#cir.fp_class<fcSNan|fcNegInf>`. This
changes operation syntax, so it updates 37 CHECK lines.
DeltaFile
+8-0clang/include/clang/CIR/Dialect/IR/CIROps.td
+8-01 files

LLVM/project 67618a3clang/include/clang/CIR/Dialect/IR CIREnumAttr.td CIROps.td

[CIR] Drop dead ceremony around the CIR enum attributes

Five things that no longer earn their place in the CIR enum attribute
machinery.

CIR_CleanupKindAttr carried three. Its cppClassName restated the default
AttrDef already derives. Its skipDefaultBuilders plus hand-written
AttrBuilder existed only to default $value to CleanupKind::All, which no
caller relies on, so the generated builders stayed suppressed for nothing.
And its summary and description restated the name, overriding the enum's own
"cleanup kind" that EnumAttr would otherwise inherit. The isNormal, isEH and
isNormalAndEH helpers stay.

CIR_TLSModelAttr's summary restated its name the same way, so only that goes.
CIR_DefaultValuedEnumParameter has never had a user.

NFC.
DeltaFile
+0-16clang/include/clang/CIR/Dialect/IR/CIROps.td
+0-5clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td
+0-212 files

LLVM/project b4bd507clang/include/clang/CIR/Dialect/IR CIROps.td

[CIR] Move the CIR enums off the legacy EnumAttrInfo hierarchy

MLIR has two enum hierarchies. `EnumAttrInfo` doubles as an `IntegerAttr`
constraint, so every CIR enum had to clear `genSpecializedAttr` to say it did
not want one. `EnumInfo` describes a C++ enum and nothing more.

Derive the CIR bases from `I32Enum`, `I64Enum` and `I32BitEnum`, and widen
`CIR_EnumAttr` to the `EnumInfo` that upstream `EnumAttr` already takes. The
flag no longer exists to clear. `FPClassTestEnum` gets unquoted printing from
`BitEnumBase` rather than overriding `printBitEnumQuoted`, and
`CIR_KnownFuncKind` drops a `parameterPrinter` the generated `operator<<`
now covers, still spelling `#cir.func_identity<"std::find">`.

AMDGPU wraps an `I32Enum` in an `EnumAttr` with this same bracketed format.
Parsing moves to the generated `FieldParser`, whose diagnostic names the
accepted spellings, so two `expected-error` lines change. Generated attribute
code drops 16 KB as 28 inlined parsers collapse into it.
DeltaFile
+0-8clang/include/clang/CIR/Dialect/IR/CIROps.td
+0-81 files

LLVM/project 8d9c175clang/include/clang/CIR/Dialect/IR CIRTypes.td CIRCUDAAttrs.td, clang/test/CIR/IR invalid-lang-attr.cir

[CIR] Move the CIR enums off the legacy EnumAttrInfo hierarchy (#220889)

MLIR has two enum hierarchies. `EnumAttrInfo` doubles as an
`IntegerAttr`
constraint, so every CIR enum had to clear `genSpecializedAttr` to say
it did
not want one. `EnumInfo` describes a C++ enum and nothing more.

Derive the CIR bases from `I32Enum`, `I64Enum` and `I32BitEnum`, and
widen
`CIR_EnumAttr` to the `EnumInfo` that upstream `EnumAttr` already takes.
The
flag no longer exists to clear. `FPClassTestEnum` gets unquoted printing
from
`BitEnumBase` rather than overriding `printBitEnumQuoted`, and
`CIR_KnownFuncKind` drops a `parameterPrinter` the generated
`operator<<`
now covers, still spelling `#cir.func_identity<"std::find">`.
DeltaFile
+33-73clang/include/clang/CIR/Dialect/IR/CIROps.td
+23-53clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+13-9clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td
+2-4clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td
+1-3clang/include/clang/CIR/Dialect/IR/CIRTypes.td
+1-1clang/test/CIR/IR/invalid-lang-attr.cir
+73-1431 files not shown
+74-1447 files

LLVM/project 6b9916ellvm/lib/Support Caching.cpp

review: sink is_local condition to ensure the cache directory path is already created
DeltaFile
+1-2llvm/lib/Support/Caching.cpp
+1-21 files

LLVM/project 691b2a1llvm/lib/Support Caching.cpp

review: OnNFS -> IsNFS
DeltaFile
+3-3llvm/lib/Support/Caching.cpp
+3-31 files

LLVM/project 92dd65fllvm/lib/Support Caching.cpp

[Support][Caching] Don't use `mmap` in `localCache`, on NFS

When the cache directory is on an NFS, we may hit a SIGBUS signal
when there is contention on the cache.

This happens typically with MPI jobs running on an NFS mounted $HOME
directory.

If we execute through the regular `read()` path, we also fail with a
`Stale file descriptor` error. But at least this path is properly handled
and we can continue without using the cache.

To achieve this, we pass `OnNFS` to `IsVolatile` and `RequiresNullTerminator`,
which makes `shouldUseMmap` return `false`.
DeltaFile
+4-1llvm/lib/Support/Caching.cpp
+4-11 files

LLVM/project 544171dllvm/include/llvm/Analysis MustExecute.h, llvm/lib/Analysis MustExecute.cpp

[LoopSafetyInfo] Store Loop and automatically compute (NFC) (#221238)

This makes two changes:

* LoopSafetyInfo is bound to a single loop. Store the Loop in the ctor,
so it does not need to be passed to individual queries.
* Automatically compute LoopSafetyInfo on construction, instead of in a
separate call. This is mostly to clarify that (contrary to the doc
comment) nobody is actually trying to invalidate LoopSafetyInfo by
rerunning computeLoopSafetyInfo().

This makes it easier to change implementation details, like computing
information lazily.
DeltaFile
+30-39llvm/include/llvm/Analysis/MustExecute.h
+19-25llvm/lib/Analysis/MustExecute.cpp
+8-11llvm/lib/Transforms/Scalar/LICM.cpp
+4-6llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+2-3llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+1-2llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
+64-861 files not shown
+65-887 files

FreeBSD/ports 1155ae4databases/pgterm Makefile distinfo

databases/pgterm: Update to 0.1.4

Upstream 0.1.4 declares the fake-pgbot test fixture as a [[bin]] target,
which cargo then installs alongside pgterm. Restrict the install to the
pgterm binary, matching upstream's own release packaging.
DeltaFile
+3-3databases/pgterm/distinfo
+4-1databases/pgterm/Makefile
+7-42 files

FreeBSD/ports 8fa94e0. UPDATING

UPDATING: Add a note about x11-wm/mango v. 0.16.3
DeltaFile
+16-0UPDATING
+16-01 files

LLVM/project 41a09bellvm/lib/Transforms/Vectorize VPlanTransforms.cpp

[VPlan] Don't recompute getPlan in simplifyRecipes. NFC (#221582)

getPlan involves a traversal, so avoid doing it on every recipe
simplified.

Improves compile time:
https://llvm-compile-time-tracker.com/compare.php?from=8f7d3ba08f14c3d54b8b407d1758dbd1da01bb38&to=aaeebfa47f57bbf1bc9f26ce9a4e777939f46352&stat=instructions:u
DeltaFile
+20-23llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+20-231 files

OpenBSD/ports 4Vt2O9rdevel/jujutsu Makefile, devel/jujutsu/pkg PLIST

   jujutsu: drop vendored fish completion

   A user reported that bookmark and revision completions do not work in fish.
   It turns out that the static completion we install in vendor_completion.d
   gets in the way. jj has supported (experimental) dynamic completetions out
   of the box since 0.24.0, which works without config for fish >=4.0.2

   Users of fish 3 will need to "jj util completion | source" to install the
   completions.

   ok kn
VersionDeltaFile
1.41+1-4devel/jujutsu/Makefile
1.18+0-1devel/jujutsu/pkg/PLIST
+1-52 files

LLVM/project 038e968lldb/test/API/commands/watchpoints/watchpoint_set_errors Makefile main.c, lldb/test/Shell/Watchpoint SetErrorCases.test

[lldb][test] Rewrite Watchpoint/SetErrorCases as API test (#221563)

This test is randomly failing on macOS bots with this error:
```
error: Command requires a process which is currently stopped.
```

There is no test logic in shell tests that can diagnose what is going on
with the process, so this patch rewrites this test as an API test where
we have better error handling.
DeltaFile
+61-0lldb/test/API/commands/watchpoints/watchpoint_set_errors/TestWatchpointSetErrors.py
+0-28lldb/test/Shell/Watchpoint/SetErrorCases.test
+0-13lldb/test/Shell/Watchpoint/Inputs/main.cpp
+9-0lldb/test/API/commands/watchpoints/watchpoint_set_errors/main.c
+3-0lldb/test/API/commands/watchpoints/watchpoint_set_errors/Makefile
+73-415 files

LLVM/project 1191f35clang/test/CodeGen ptr-subtract-stable.c, clang/test/CodeGenOpenCL size_t.cl

Reapply [Clang][CodeGen] Use ptrtoaddr for pointer diff (#210729) (#221675)

Reapply https://github.com/llvm/llvm-project/pull/210729 without change
after https://github.com/llvm/llvm-project/pull/221188, which should fix
the miscompiles this change exposed.

-----

We don't have to expose the provenance of pointers for pointer
subtraction, so use ptrtoaddr instead of ptrtoint if -fwrapv-pointer is
not set.

Co-authored-by: Alexis Engelke <engelke at in.tum.de>
DeltaFile
+1,049-1,049clang/test/OpenMP/parallel_for_codegen.cpp
+124-118clang/test/OpenMP/stripe_codegen.cpp
+82-78clang/test/OpenMP/fuse_codegen.cpp
+36-36clang/test/OpenMP/reverse_codegen.cpp
+25-17clang/test/CodeGenOpenCL/size_t.cl
+21-7clang/test/CodeGen/ptr-subtract-stable.c
+1,337-1,30511 files not shown
+1,407-1,36517 files

LLVM/project 345dd01clang/docs StandardCPlusPlusModules.md, clang/lib/DependencyScanning ModuleDepCollector.cpp

[C++20] [Modules] [ScanDeps] Scan results for module map file (#221652)

Previously we described the trick to use module map to import std module
implicitly. But in practice, this may not work as build tools can't get
the dependencies.

In this patch, we updated clang-scan-deps to report the dependencies
between consumers and the corresponding module described in module map
file in P1689 format. The P1689 format in clang-scan-deps is the defacto
dependency description between compiler and build tools. This helps end
users to use the trick without waiting for the support from various
build tools.
DeltaFile
+132-0clang/test/ClangScanDeps/p1689-module-map.cppm
+46-37clang/lib/Lex/PPDirectives.cpp
+31-0clang/docs/StandardCPlusPlusModules.md
+28-2clang/test/ClangScanDeps/P1689.cppm
+19-5clang/lib/DependencyScanning/ModuleDepCollector.cpp
+5-0clang/lib/Tooling/DependencyScanningTool.cpp
+261-443 files not shown
+270-449 files

LLVM/project ae814d0llvm/lib/Analysis InstructionSimplify.cpp, llvm/test/Transforms/InstSimplify call.ll

[InstSimplify] Improve coverage for zero-shift-guard folding for rotate (#217033)

The current logic responsible to fold zero-shift-guard performed the
folding only when the shift amount is exactly zero. But, the guard could
be eliminated as long as the funnel shift instruction is performing a
bitwise rotate and the shift amount is a multiple of the bitwidth of the
value being rotated. This commit makes this change.
DeltaFile
+143-0llvm/test/Transforms/InstSimplify/call.ll
+21-5llvm/lib/Analysis/InstructionSimplify.cpp
+164-52 files

LLVM/project 954e914llvm/lib/Target/SPIRV SPIRVNonSemanticDebugHandler.cpp, llvm/test/CodeGen/SPIRV/debug-info debug-scope-same-line.ll debug-scope-block.ll

Add support for NSDI DebugScope, DebugNoScope and DebugInlinedAt
DeltaFile
+127-18llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+83-0llvm/test/CodeGen/SPIRV/debug-info/debug-inlined-at-recursive.ll
+68-0llvm/test/CodeGen/SPIRV/debug-info/debug-inlined-at.ll
+67-0llvm/test/CodeGen/SPIRV/debug-info/debug-scope.ll
+66-0llvm/test/CodeGen/SPIRV/debug-info/debug-scope-block.ll
+63-0llvm/test/CodeGen/SPIRV/debug-info/debug-scope-same-line.ll
+474-1815 files not shown
+657-2121 files

FreeBSD/ports bbc6ec4x11-wm/mango pkg-plist distinfo, x11-wm/mango/files patch-src_mango.c patch-src_dispatch_bind__define.h

x11-wm/mango: Update to 0.16.3

- Update LICENSE field
- Update list of dependencies
- Update pkg-message:

  1. when installing the port, to notify the incompatibility of this
     version of Mango with x11/waybar v. 0.15.0
  2. when upgrading the port, to notify some breaking changes too.

ChangeLog:

1. https://github.com/mangowm/mango/releases/tag/0.15.0
2. https://github.com/mangowm/mango/releases/tag/0.15.1
3. https://github.com/mangowm/mango/releases/tag/0.15.2
4. https://github.com/mangowm/mango/releases/tag/0.15.3
5. https://github.com/mangowm/mango/releases/tag/0.15.4
6. https://github.com/mangowm/mango/releases/tag/0.15.5
7. https://github.com/mangowm/mango/releases/tag/0.15.6

    [6 lines not shown]
DeltaFile
+9-13x11-wm/mango/Makefile
+21-0x11-wm/mango/files/pkg-message.in
+11-0x11-wm/mango/files/patch-src_dispatch_bind__define.h
+3-3x11-wm/mango/files/patch-src_mango.c
+3-3x11-wm/mango/distinfo
+1-0x11-wm/mango/pkg-plist
+48-196 files

NetBSD/pkgsrc lPI1VxNdoc TODO

   doc/TODO: add some

   + compiledb-go-1.7.1, ggml-0.23.0, grafana-13.2.1, hwdata-0.411,
     mapserver-8.6.6, p5-Data-OptList-0.115, p5-DateTime-1.6700,
     p5-LWP-MediaTypes-6.05, p5-Net-DNS-1.57, p5-Sub-Exporter-0.992,
     p5-URI-5.37, py-filelock-3.32.5, py-google-api-core-2.36.0,
     py-google-auth-2.57.1, py-googleapis-common-protos-1.75.3,
     py-pdf-6.17.0, py-ruff-0.16.6, py-uv-build-0.12.10, py-zensical-0.0.59,
     qca2-qt6-2.3.12, rumdl-0.2.66, shuck-0.2.1, tabiew-0.15.0,
     tree-sitter-0.27.0, weechat-4.10.1, yazi-26.9.1.
VersionDeltaFile
1.27868+27-1doc/TODO
+27-11 files

OpenBSD/src dNjCqYglib/libpcap optimize.c, sys/net bpf_filter.c

   Fix various minor things in our bpf implementation

   In userland it is possible to call bpf_filter / pcap_offline_filter
   with unverified bpf programs. Because of this harden bpf_filter further
   by adding the following extra checks:

   - Ensure that load and store operations to the scratch memory store are
   always bound checked.
   - Ensure that no division or modulo by zero is done.
   - No longer do shift operations with a too large shift exponent. Instead
   zero out the result.
   - No longer call abort on unknown instructions when bpf_filter is run
   in userland. Use the same return 0 as is already done in the kernel.

   On top of this ensure that no unhandled instruction encoding makes it
   through bpf_validate by using the same case handling as bpf_filter.

   This are fixes for libpcap CVE-2026-0799, CVE-2026-6244, CVE-2026-6554,
   CVE-2026-31911.  None of the above CVEs are applicable to or kernel since

    [2 lines not shown]
VersionDeltaFile
1.39+74-17sys/net/bpf_filter.c
1.24+7-3lib/libpcap/optimize.c
+81-202 files

FreeBSD/ports 9f4e618x11/mangobar pkg-descr Makefile, x11/mangobar/files pkg-message.in patch-meson.build

x11/mangobar: Add new port

Mangobar is a Wayland status bar for mangowm, built on wlr-layer-shell. It
reads all of its runtime settings from JSONC and CSS; there are no hard-coded
module defaults beyond sample files.
The system tray (StatusNotifierItem / DBusMenu) is inspired by swaybar and
waybar.

https://github.com/mangowm/mangobar
DeltaFile
+40-0x11/mangobar/Makefile
+22-0x11/mangobar/files/patch-config.jsonc
+14-0x11/mangobar/files/patch-meson.build
+14-0x11/mangobar/files/patch-mangobar.c
+13-0x11/mangobar/files/pkg-message.in
+5-0x11/mangobar/pkg-descr
+108-02 files not shown
+112-08 files

LLVM/project 920d73dclang/include/clang/CIR/Dialect/IR CIRTypes.td CIRCUDAAttrs.td, clang/test/CIR/IR invalid-lang-attr.cir

[CIR] Move the CIR enums off the legacy EnumAttrInfo hierarchy

MLIR has two enum hierarchies. `EnumAttrInfo` doubles as an `IntegerAttr`
constraint, so every CIR enum had to clear `genSpecializedAttr` to say it did
not want one. `EnumInfo` describes a C++ enum and nothing more.

Derive the CIR bases from `I32Enum`, `I64Enum` and `I32BitEnum`, and widen
`CIR_EnumAttr` to the `EnumInfo` that upstream `EnumAttr` already takes. The
flag no longer exists to clear. `FPClassTestEnum` gets unquoted printing from
`BitEnumBase` rather than overriding `printBitEnumQuoted`, and
`CIR_KnownFuncKind` drops a `parameterPrinter` the generated `operator<<`
now covers, still spelling `#cir.func_identity<"std::find">`.

AMDGPU wraps an `I32Enum` in an `EnumAttr` with this same bracketed format.
Parsing moves to the generated `FieldParser`, whose diagnostic names the
accepted spellings, so two `expected-error` lines change. Generated attribute
code drops 16 KB as 28 inlined parsers collapse into it.
DeltaFile
+33-73clang/include/clang/CIR/Dialect/IR/CIROps.td
+23-53clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+13-9clang/include/clang/CIR/Dialect/IR/CIREnumAttr.td
+2-4clang/include/clang/CIR/Dialect/IR/CIRCUDAAttrs.td
+1-3clang/include/clang/CIR/Dialect/IR/CIRTypes.td
+1-1clang/test/CIR/IR/invalid-lang-attr.cir
+73-1431 files not shown
+74-1447 files

LLVM/project fc3ad3fclang/include/clang/CIR/Dialect/IR CIROps.td, clang/test/CIR/CodeGenBuiltins builtin-isinf-sign.c builtin-isfpclass.c

[CIR] Migrate the FPClassTest bit enum and unquote its flags (#220888)

cir.is_fp_class printed its flags inconsistently. Single-bit values came
out
bare, as in `fcSNan`, while group values and combinations came out
quoted, as
in `"fcInf"` and `"fcSNan|fcNegInf"`. That comes from I32BitEnumAttr
setting
printBitEnumQuoted, which EnumAttr.td keeps only for backwards
compatibility.

Clearing the bit and using the `enum` directive selects the
separator-aware
parser and printer, so every value now spells unquoted:

  cir.is_fp_class %x, fcSNan|fcNegInf : (!cir.float) -> !cir.bool

The enum also drops its specialized IntegerAttr for a CIR_EnumAttr
wrapper,
giving it the standalone spelling `#cir.fp_class<fcSNan|fcNegInf>`.
DeltaFile
+20-20clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
+16-16clang/test/CIR/CodeGenBuiltins/builtin-isfpclass.c
+20-0clang/test/CIR/IR/enum-attrs.cir
+12-2clang/include/clang/CIR/Dialect/IR/CIROps.td
+1-1clang/test/CIR/CodeGenBuiltins/builtin-isinf-sign.c
+69-395 files

LLVM/project c5a85b9clang/lib/CIR/CodeGen CIRGenModule.cpp TargetInfo.h, clang/lib/CIR/CodeGen/Targets SPIRV.cpp

[CIR] Fix address space issues related to SPIR/SPIR-V targets (#220982)

This adds support for address space lowering for spir/spir64 (not v)
which are still widely used in OpenCL testing despite spirv32/spirv64
targets existence. This also corrects alloca address space for all
mentioned targets from default to private which is semantically correct
for them and avoids emission of spurious address space casts.

Assisted-by: claude in test cases updating
DeltaFile
+19-21clang/test/CIR/CodeGenOpenCL/address-space-local-var.clcpp
+15-8clang/lib/CIR/CodeGen/Targets/SPIRV.cpp
+1-4clang/test/CIR/CodeGenOpenCL/address-spaces.cl
+2-1clang/lib/CIR/CodeGen/TargetInfo.h
+1-1clang/lib/CIR/CodeGen/CIRGenModule.cpp
+2-0clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerModule.cpp
+40-356 files

NetBSD/pkgsrc 8tBYi5ydatabases/redis Makefile

   redis: Replace interpreter for scripts/build.sh.

   Despite a comment at the top of the script saying it is designed for POSIX
   sh, it uses the non-portable 'local' keyword.
VersionDeltaFile
1.106+3-1databases/redis/Makefile
+3-11 files

FreeBSD/src c6df112sys/kern sched_4bsd.c

sched_4bsd: Allocate runqueues only for present CPUs

4BSD has been allocating an array of MAXCPU runqueues, runq_pcpu[],
instead of one runqueue per actually present CPU.  On amd64, MAXCPU is
1024 and 'struct runq' is 4128 bytes, causing runq_pcpu[] to take more
than 4 MiB of memory.  On the vast majority of current systems, which
have at most 32 cores with SMT, this is a waste of memory.

Besides providing per-CPU runqueues, runq_pcpu[] has also been used to
determine the CPU ID of a given thread's associated runqueue through
pointer arithmetic.

Since per-CPU structures are only allocated for present CPUs, in order
to save space, move the runqueues to per-CPU fields and, for each thread
('struct ts_sched'), replace its runqueue pointer by the CPU ID of the
runqueue it is in (new 'ts_rqcpu' field).  Set the thread's CPU ID to
the special NOCPU value when it is running on the global runqueue.

Drop the SKE_RUNQ_PCPU() macro as it is now simply equivalent to

    [13 lines not shown]
DeltaFile
+30-27sys/kern/sched_4bsd.c
+30-271 files

FreeBSD/src 5806717sys/kern sched_4bsd.c

sched_4bsd: Remove obsolete SMP scaling for ticks per priority level

The INVERSE_ESTCPU_WEIGHT scaling had been introduced by commit
b698380f33ef ("Quick fix for scaling of statclock ticks in the SMP
case. ...") to leave more discrimination room for multiple CPUs possibly
adding their ticks to the same 'struct ksegrp' (but also slightly
changing how CPU hogs are penalized).

Then, commit 8460a577a4b4 ("Make KSE a kernel option, ...") introduced
the current thread-based code, where tick accounting is only done on the
current thread, which renders this trick obsolete on !KSE.

Finally, when KSE was removed, the trick became generally obsolete.

The trick is actually even harmful because it changes the intended
behavior of priorizing more the CPUs that use the less ticks (and so,
impairs boosting "interactive" processes).

Remove it now.  Clamping of 'ts_estcpu' and its relation to the

    [8 lines not shown]
DeltaFile
+0-4sys/kern/sched_4bsd.c
+0-41 files

FreeBSD/src 5db755asys/kern sched_4bsd.c

sched_4bsd: Fix conflating priority of differently-niced CPU-bound threads

We introduced (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) as part of
ESTCPULIM() in commit eebc148f25c3 ("sched_4bsd: ESTCPULIM(): Allow any
value in the timeshare range") in order to use more than a fixed number
(40) of all the available priority levels in the timeshare range (136
before the 256-queue runqueue work, 224 now) to take into account the
number of ticks a thread has run ('ts_estcpu').

In the computation of a new thread's priority (resetpriority()), in
addition to the "ticks running" contribution, the final priority also
includes a "nice" value contribution.  The final value is clamped into
the [PRI_MIN_TIMESHARE; PRI_MAX_TRIMESHARE] range.

Problem is that the new "ticks running" contribution now can lead to
a computed priority value that exceeds PRI_MAX_TRIMESHARE, and is thus
finally clamped to PRI_MAX_TIMESHARE, which becomes an alias for all
out-of-bound values.  In particular, this can conflate CPU-hungry
threads.  With at least two of them competing on the same CPU, with an

    [22 lines not shown]
DeltaFile
+7-5sys/kern/sched_4bsd.c
+7-51 files