pbus_size_mem(9)
π pbus_size_mem β the kernel API manual, bestie edition β¨
Okay so you're looking at pbus_size_mem(9) (that's the manual page name, yes it's giving very "section 9 energy" π), and honestly? It's a sleeper hit. Let's get into it.
πΈ NAME πΈ
pbus_size_mem β size the memory window of a given bus π¦
Like, it literally just figures out how big a bus's memory window needs to be. Iconic behavior, no notes.
β¨ SYNOPSIS β¨
void pbus_size_mem (struct pci_bus *bus , struct resource *b_res ,
resource_size_t add_size , struct list_head *realloc_head );
That's the whole signature, character for character, don't come for me π
π«Ά ARGUMENTS π«Ά
busβ the bus. That's it, that's the whole vibe. It's the bus. πb_resβ the bridge window resource π (the actual thing being sized, main character honestly)add_sizeβ additional memory window, like extra on top of what's already thererealloc_headβ track the additional memory window on this list π (yes it's astruct list_head *, yes it keeps receipts)
π DESCRIPTION π
So here's what it actually does, and lowkey it's doing a lot:
- It calculates the size of the bridge window
b_resand the minimal alignment that guarantees all child resources fit in that size. The way it justβ¦ makes everything fit ππ - It sets the bus resource start/end to indicate the required size β but only if there's an available unassigned bus resource of the desired type. Conditional queen π
- It adds optional resource requests to the
realloc_headlist, if that list is supplied. If you didn't pass one? It simply doesn't. Respect. π§
fr fr, that's the whole description β every clause kept, nothing invented, we don't do fanfic here π
π SEE ALSO π
Peep the kernel file ./drivers/pci/setup-bus.c β that's where the magic lives, bestie π₯
And the whole friend group of related functions, all of them, in order:
pci_dev_res_add_to_list(9)pbus_select_window_for_type(9)pbus_select_window(9)reassign_resources_sorted(9)assign_requested_resources_sorted(9)pbus_size_io(9)
That's the pbus_size_io(9) sibling β the I/O counterpart, we love a matching set π
And that's the page!! π This lil cutie lives in ./drivers/pci, and the version of this manual you're reading is dated October 2026 β so go forth, size those memory windows, and slay π
β¨π¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms