Skip to content

Add groupCount/groupMasks to CACHE_RELATIONSHIP#1720

Merged
dbwiddis merged 1 commit intojava-native-access:masterfrom
dbwiddis:fix-cache-relationship-groupcount
May 10, 2026
Merged

Add groupCount/groupMasks to CACHE_RELATIONSHIP#1720
dbwiddis merged 1 commit intojava-native-access:masterfrom
dbwiddis:fix-cache-relationship-groupcount

Conversation

@dbwiddis
Copy link
Copy Markdown
Contributor

Add groupCount/groupMasks to CACHE_RELATIONSHIP

The Windows CACHE_RELATIONSHIP struct was updated (Windows Server 2022 / 21H2) to repurpose 2 of its 20 reserved bytes as a GroupCount field and replace the single GroupMask with a variable-length GroupMasks array. This is the same change documented in #1324 for NUMA_NODE_RELATIONSHIP.

Changes

  • Shrink reserved from 20 to 18 bytes
  • Add groupCount (short) field
  • Add groupMasks (GROUP_AFFINITY[]) array
  • Retain groupMask as a public compatibility field (populated from groupMasks[0])
  • Override read() to dynamically size the array based on groupCount
  • Override getFieldList() to exclude the compatibility groupMask field from structure validation

Sources

Backward compatibility

On older Windows versions where GroupCount is 0 (the bytes were previously reserved/zeroed), the read() override forces a minimum array size of 1 and copies the value to groupMask, preserving existing behavior.

Closes #1674

Closes java-native-access#1674

The Windows CACHE_RELATIONSHIP struct was updated to use 2 of its
reserved bytes for a GroupCount field and replace the single
GroupMask with a variable-length GroupMasks array, matching the
same change previously made to NUMA_NODE_RELATIONSHIP.

Shrink reserved from 20 to 18 bytes, add groupCount (short) and
groupMasks array with a read() override to handle both old and new
struct layouts.
@dbwiddis dbwiddis force-pushed the fix-cache-relationship-groupcount branch from 70cfa71 to 79e2aa5 Compare May 10, 2026 14:27
Copy link
Copy Markdown
Member

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thank you.

@dbwiddis dbwiddis merged commit e75a0bf into java-native-access:master May 10, 2026
12 checks passed
@dbwiddis dbwiddis deleted the fix-cache-relationship-groupcount branch May 10, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WinNT CACHE_RELATIONSHIP uses 2 reserved bytes for Group Count

2 participants