sgl_alloc_order(9)
β¨ sgl_alloc_order(9) β¨
okay so bestie, we're in the Kernel API Manual today and this one is called sgl_alloc_order β it's a (9) page so you already know it's kernel-internal, iykyk π
π NAME π
sgl_alloc_order β allocate a scatterlist and all its pages, together, in one go π«Ά
πΈ SYNOPSIS πΈ
struct scatterlist * sgl_alloc_order (unsigned long long length ,
unsigned int order , bool chainable , gfp_t gfp , unsigned int *nent_p
);
π¦ ARGUMENTS π¦
lengthβ the length in bytes of the scatterlist. Lowkey important: it must be at least one βorderβ this is the second argument you'd hand toalloc_pagesπchainableβ whether or not to allocate an extra element in the scatterlist, for scatterlist chaining purposes πgfpβ the memory allocation flags πnent_pβ[out], so it's where the answer comes back to you: the number of entries in the scatterlist that actually have pages π
π RETURN π
You get a pointer to an initialized scatterlist π« or NULL upon failure π (yes, check it, always check it).
π SEE ALSO π
Kernel file ./lib/scatterlist.c, plus the whole scatterlist friend group:
sg_nents(9)sg_nents_for_len(9)sg_nents_for_dma(9)sg_last(9)sg_init_table(9)sg_init_one(9)__sg_free_table(9)sg_free_append_table(9)sg_free_table(9)__sg_alloc_table(9)sg_alloc_table(9)sg_alloc_append_table_from_pages(9)sg_alloc_table_from_pages_segment(9)sgl_alloc(9)sgl_free_n_order(9)sgl_free_order(9)sgl_free(9)sg_miter_start(9)sg_miter_skip(9)sg_miter_next(9)sg_miter_stop(9)sg_copy_buffer(9)sg_copy_from_buffer(9)sg_copy_to_buffer(9)sg_pcopy_from_buffer(9)sg_pcopy_to_buffer(9)sg_zero_buffer(9)extract_iter_to_sg(9)
and that's the whole vibe check bestie, go allocate something iconic πβ¨
this page lives in ./lib, version dated October 2026, and it's sgl_alloc_order(9) β mwah, slay, periodt ππ
π¦ 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