isphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}(hhparenthuba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}(hhhh2ubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}(hhhhFubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}(hhhhZubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}(hhhhnubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}(hhhhubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhtarget)}(h.. _gfp_mask_from_fs_io:h]h}(h]h ]h"]h$]h&]refidgfp-mask-from-fs-iouh1hhKhhhhhJ/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io.rstubhsection)}(hhh](htitle)}(h!GFP masks used from FS/IO contexth]h!GFP masks used from FS/IO context}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh field_list)}(hhh](hfield)}(hhh](h field_name)}(hDateh]hDate}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhKubh field_body)}(h May, 2018h]h paragraph)}(hhh]h May, 2018}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hAuthorh]hAuthor}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhKubh)}(h!Michal Hocko h]h)}(h Michal Hocko h](hMichal Hocko <}(hMichal Hocko }(h>hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Introductionh]h Introduction}(hjRhjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjMhhhhhK ubh)}(hX!Code paths in the filesystem and IO stacks must be careful when allocating memory to prevent recursion deadlocks caused by direct memory reclaim calling back into the FS or IO paths and blocking on already held resources (e.g. locks - most commonly those used for the transaction context).h]hX!Code paths in the filesystem and IO stacks must be careful when allocating memory to prevent recursion deadlocks caused by direct memory reclaim calling back into the FS or IO paths and blocking on already held resources (e.g. locks - most commonly those used for the transaction context).}(hj`hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjMhhubh)}(hX The traditional way to avoid this deadlock problem is to clear __GFP_FS respectively __GFP_IO (note the latter implies clearing the first as well) in the gfp mask when calling an allocator. GFP_NOFS respectively GFP_NOIO can be used as shortcut. It turned out though that above approach has led to abuses when the restricted gfp mask is used "just in case" without a deeper consideration which leads to problems because an excessive use of GFP_NOFS/GFP_NOIO can lead to memory over-reclaim or other memory reclaim issues.h]hX The traditional way to avoid this deadlock problem is to clear __GFP_FS respectively __GFP_IO (note the latter implies clearing the first as well) in the gfp mask when calling an allocator. GFP_NOFS respectively GFP_NOIO can be used as shortcut. It turned out though that above approach has led to abuses when the restricted gfp mask is used “just in case” without a deeper consideration which leads to problems because an excessive use of GFP_NOFS/GFP_NOIO can lead to memory over-reclaim or other memory reclaim issues.}(hjnhjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjMhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hNew APIh]hNew API}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXSince 4.12 we do have a generic scope API for both NOFS and NOIO context ``memalloc_nofs_save``, ``memalloc_nofs_restore`` respectively ``memalloc_noio_save``, ``memalloc_noio_restore`` which allow to mark a scope to be a critical section from a filesystem or I/O point of view. Any allocation from that scope will inherently drop __GFP_FS respectively __GFP_IO from the given mask so no memory allocation can recurse back in the FS/IO.h](hISince 4.12 we do have a generic scope API for both NOFS and NOIO context }(hISince 4.12 we do have a generic scope API for both NOFS and NOIO context hjhhhNhNubhliteral)}(h``memalloc_nofs_save``h]hmemalloc_nofs_save}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(h, hjhhhNhNubj)}(h``memalloc_nofs_restore``h]hmemalloc_nofs_restore}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh respectively }(h respectively hjhhhNhNubj)}(h``memalloc_noio_save``h]hmemalloc_noio_save}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(h, hjhhhNhNubj)}(h``memalloc_noio_restore``h]hmemalloc_noio_restore}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh which allow to mark a scope to be a critical section from a filesystem or I/O point of view. Any allocation from that scope will inherently drop __GFP_FS respectively __GFP_IO from the given mask so no memory allocation can recurse back in the FS/IO.}(h which allow to mark a scope to be a critical section from a filesystem or I/O point of view. Any allocation from that scope will inherently drop __GFP_FS respectively __GFP_IO from the given mask so no memory allocation can recurse back in the FS/IO.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](singlememalloc_nofs_save (C function)c.memalloc_nofs_savehNtauh1jhjhhhNhNubhdesc)}(hhh](hdesc_signature)}(h&unsigned int memalloc_nofs_save (void)h]hdesc_signature_line)}(h%unsigned int memalloc_nofs_save(void)h](hdesc_sig_keyword_type)}(hunsignedh]hunsigned}(hhhjhhhNhNubah}(h]h ]ktah"]h$]h&]uh1jhjhhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMubhdesc_sig_space)}(h h]h }(hhhj&hhhNhNubah}(h]h ]wah"]h$]h&]uh1j$hjhhhj#hMubj)}(hinth]hint}(hhhj5hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhj#hMubj%)}(h h]h }(hhhjChhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hjhhhj#hMubh desc_name)}(hmemalloc_nofs_saveh]h desc_sig_name)}(hmemalloc_nofs_saveh]hmemalloc_nofs_save}(hhhjYhhhNhNubah}(h]h ]nah"]h$]h&]uh1jWhjSubah}(h]h ](sig-namedescnameeh"]h$]h&] xml:spacepreserveuh1jQhjhhhj#hMubhdesc_parameterlist)}(h(void)h]hdesc_parameter)}(hvoidh]j)}(hvoidh]hvoid}(hhhj~hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjzubah}(h]h ]h"]h$]h&]noemphjpjquh1jxhjtubah}(h]h ]h"]h$]h&]jpjquh1jrhjhhhj#hMubeh}(h]h ]h"]h$]h&]jpjq add_permalinkuh1j sphinx_line_type declaratorhjhhhj#hMubah}(h]jah ](sig sig-objecteh"]h$]h&] is_multilineuh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjhhubh desc_content)}(hhh]h)}(h)Marks implicit GFP_NOFS allocation scope.h]h)Marks implicit GFP_NOFS allocation scope.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhj#hMubeh}(h]h ](cfunctioneh"]h$]h&]domainjobjtypejdesctypejnoindexuh1jhhhjhNhNubh container)}(hX**Parameters** ``void`` no arguments **Description** This functions marks the beginning of the GFP_NOFS allocation scope. All further allocations will implicitly drop __GFP_FS flag and so they are safe for the FS critical section from the allocation recursion point of view. Use memalloc_nofs_restore to end the scope with flags returned by this function. **Context** This function is safe to be used from any context. **Return** The saved flags to be passed to memalloc_nofs_restore.h](h)}(h**Parameters**h]hstrong)}(hjh]h Parameters}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubhdefinition_list)}(hhh]hdefinition_list_item)}(h``void`` no arguments h](hterm)}(h``void``h]j)}(hjh]hvoid}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh definition)}(hhh]h)}(h no argumentsh]h no arguments}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhMhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hj>h]h Description}(hhhj@hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj<ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh)}(hX.This functions marks the beginning of the GFP_NOFS allocation scope. All further allocations will implicitly drop __GFP_FS flag and so they are safe for the FS critical section from the allocation recursion point of view. Use memalloc_nofs_restore to end the scope with flags returned by this function.h]hX.This functions marks the beginning of the GFP_NOFS allocation scope. All further allocations will implicitly drop __GFP_FS flag and so they are safe for the FS critical section from the allocation recursion point of view. Use memalloc_nofs_restore to end the scope with flags returned by this function.}(hjVhjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh)}(h **Context**h]j)}(hjeh]hContext}(hhhjghhhNhNubah}(h]h ]h"]h$]h&]uh1jhjcubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh)}(h2This function is safe to be used from any context.h]h2This function is safe to be used from any context.}(hj}hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh)}(h **Return**h]j)}(hjh]hReturn}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh)}(h6The saved flags to be passed to memalloc_nofs_restore.h]h6The saved flags to be passed to memalloc_nofs_restore.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjhhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](j"memalloc_nofs_restore (C function)c.memalloc_nofs_restorehNtauh1jhjhhhNhNubj)}(hhh](j)}(h/void memalloc_nofs_restore (unsigned int flags)h]j )}(h.void memalloc_nofs_restore(unsigned int flags)h](j)}(hvoidh]hvoid}(hhhjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMubj%)}(h h]h }(hhhjhhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hjhhhjhMubjR)}(hmemalloc_nofs_restoreh]jX)}(hmemalloc_nofs_restoreh]hmemalloc_nofs_restore}(hhhjhhhNhNubah}(h]h ]jdah"]h$]h&]uh1jWhjubah}(h]h ](jkjleh"]h$]h&]jpjquh1jQhjhhhjhMubjs)}(h(unsigned int flags)h]jy)}(hunsigned int flagsh](j)}(hunsignedh]hunsigned}(hhhjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj%)}(h h]h }(hhhjhhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hj ubj)}(hinth]hint}(hhhj*hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj ubj%)}(h h]h }(hhhj8hhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hj ubjX)}(hflagsh]hflags}(hhhjFhhhNhNubah}(h]h ]jdah"]h$]h&]uh1jWhj ubeh}(h]h ]h"]h$]h&]noemphjpjquh1jxhjubah}(h]h ]h"]h$]h&]jpjquh1jrhjhhhjhMubeh}(h]h ]h"]h$]h&]jpjqjuh1j jjhjhhhjhMubah}(h]jah ](jjeh"]h$]h&]juh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjhhubj)}(hhh]h)}(h!Ends the implicit GFP_NOFS scope.h]h!Ends the implicit GFP_NOFS scope.}(hjshjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjnhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhMubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjuh1jhhhjhNhNubj)}(h**Parameters** ``unsigned int flags`` Flags to restore. **Description** Ends the implicit GFP_NOFS scope started by memalloc_nofs_save function. Always make sure that the given flags is the return value from the pairing memalloc_nofs_save call.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubj)}(hhh]j)}(h)``unsigned int flags`` Flags to restore. h](j)}(h``unsigned int flags``h]j)}(hjh]hunsigned int flags}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubj)}(hhh]h)}(hFlags to restore.h]hFlags to restore.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhMhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hjh]h Description}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubh)}(hEnds the implicit GFP_NOFS scope started by memalloc_nofs_save function. Always make sure that the given flags is the return value from the pairing memalloc_nofs_save call.h]hEnds the implicit GFP_NOFS scope started by memalloc_nofs_save function. Always make sure that the given flags is the return value from the pairing memalloc_nofs_save call.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjhhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](jmemalloc_noio_save (C function)c.memalloc_noio_savehNtauh1jhjhhhNhNubj)}(hhh](j)}(h&unsigned int memalloc_noio_save (void)h]j )}(h%unsigned int memalloc_noio_save(void)h](j)}(hunsignedh]hunsigned}(hhhj2hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj.hhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMhubj%)}(h h]h }(hhhjAhhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hj.hhhj@hMhubj)}(hinth]hint}(hhhjOhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj.hhhj@hMhubj%)}(h h]h }(hhhj]hhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hj.hhhj@hMhubjR)}(hmemalloc_noio_saveh]jX)}(hmemalloc_noio_saveh]hmemalloc_noio_save}(hhhjohhhNhNubah}(h]h ]jdah"]h$]h&]uh1jWhjkubah}(h]h ](jkjleh"]h$]h&]jpjquh1jQhj.hhhj@hMhubjs)}(h(void)h]jy)}(hvoidh]j)}(hvoidh]hvoid}(hhhjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]noemphjpjquh1jxhjubah}(h]h ]h"]h$]h&]jpjquh1jrhj.hhhj@hMhubeh}(h]h ]h"]h$]h&]jpjqjuh1j jjhj*hhhj@hMhubah}(h]j%ah ](jjeh"]h$]h&]juh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMrhj'hhubj)}(hhh]h)}(h)Marks implicit GFP_NOIO allocation scope.h]h)Marks implicit GFP_NOIO allocation scope.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMghjhhubah}(h]h ]h"]h$]h&]uh1jhj'hhhj@hMhubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjuh1jhhhjhNhNubj)}(hX**Parameters** ``void`` no arguments **Description** This functions marks the beginning of the GFP_NOIO allocation scope. All further allocations will implicitly drop __GFP_IO flag and so they are safe for the IO critical section from the allocation recursion point of view. Use memalloc_noio_restore to end the scope with flags returned by this function. **Context** This function is safe to be used from any context. **Return** The saved flags to be passed to memalloc_noio_restore.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMkhjubj)}(hhh]j)}(h``void`` no arguments h](j)}(h``void``h]j)}(hjh]hvoid}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMnhjubj)}(hhh]h)}(h no argumentsh]h no arguments}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hMnhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhj hMnhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hj2h]h Description}(hhhj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMphjubh)}(hX.This functions marks the beginning of the GFP_NOIO allocation scope. All further allocations will implicitly drop __GFP_IO flag and so they are safe for the IO critical section from the allocation recursion point of view. Use memalloc_noio_restore to end the scope with flags returned by this function.h]hX.This functions marks the beginning of the GFP_NOIO allocation scope. All further allocations will implicitly drop __GFP_IO flag and so they are safe for the IO critical section from the allocation recursion point of view. Use memalloc_noio_restore to end the scope with flags returned by this function.}(hjJhjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMihjubh)}(h **Context**h]j)}(hjYh]hContext}(hhhj[hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjWubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMohjubh)}(h2This function is safe to be used from any context.h]h2This function is safe to be used from any context.}(hjqhjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMohjubh)}(h **Return**h]j)}(hjh]hReturn}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj~ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMqhjubh)}(h6The saved flags to be passed to memalloc_noio_restore.h]h6The saved flags to be passed to memalloc_noio_restore.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMphjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjhhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](j"memalloc_noio_restore (C function)c.memalloc_noio_restorehNtauh1jhjhhhNhNubj)}(hhh](j)}(h/void memalloc_noio_restore (unsigned int flags)h]j )}(h.void memalloc_noio_restore(unsigned int flags)h](j)}(hvoidh]hvoid}(hhhjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMyubj%)}(h h]h }(hhhjhhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hjhhhjhMyubjR)}(hmemalloc_noio_restoreh]jX)}(hmemalloc_noio_restoreh]hmemalloc_noio_restore}(hhhjhhhNhNubah}(h]h ]jdah"]h$]h&]uh1jWhjubah}(h]h ](jkjleh"]h$]h&]jpjquh1jQhjhhhjhMyubjs)}(h(unsigned int flags)h]jy)}(hunsigned int flagsh](j)}(hunsignedh]hunsigned}(hhhjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj%)}(h h]h }(hhhjhhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hjubj)}(hinth]hint}(hhhjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj%)}(h h]h }(hhhj,hhhNhNubah}(h]h ]j1ah"]h$]h&]uh1j$hjubjX)}(hflagsh]hflags}(hhhj:hhhNhNubah}(h]h ]jdah"]h$]h&]uh1jWhjubeh}(h]h ]h"]h$]h&]noemphjpjquh1jxhjubah}(h]h ]h"]h$]h&]jpjquh1jrhjhhhjhMyubeh}(h]h ]h"]h$]h&]jpjqjuh1j jjhjhhhjhMyubah}(h]jah ](jjeh"]h$]h&]juh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMhjhhubj)}(hhh]h)}(h!Ends the implicit GFP_NOIO scope.h]h!Ends the implicit GFP_NOIO scope.}(hjghjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMxhjbhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhMyubeh}(h]h ](jfunctioneh"]h$]h&]jjjj}jj}juh1jhhhjhNhNubj)}(h**Parameters** ``unsigned int flags`` Flags to restore. **Description** Ends the implicit GFP_NOIO scope started by memalloc_noio_save function. Always make sure that the given flags is the return value from the pairing memalloc_noio_save call.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhM|hjubj)}(hhh]j)}(h)``unsigned int flags`` Flags to restore. h](j)}(h``unsigned int flags``h]j)}(hjh]hunsigned int flags}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMyhjubj)}(hhh]h)}(hFlags to restore.h]hFlags to restore.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhMyhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhMyhjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hjh]h Description}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhM{hjubh)}(hEnds the implicit GFP_NOIO scope started by memalloc_noio_save function. Always make sure that the given flags is the return value from the pairing memalloc_noio_save call.h]hEnds the implicit GFP_NOIO scope started by memalloc_noio_save function. Always make sure that the given flags is the return value from the pairing memalloc_noio_save call.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhM{hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjhhhNhNubh)}(hXFS/IO code then simply calls the appropriate save function before any critical section with respect to the reclaim is started - e.g. lock shared with the reclaim context or when a transaction context nesting would be possible via reclaim. The restore function should be called when the critical section ends. All that ideally along with an explanation what is the reclaim context for easier maintenance.h]hXFS/IO code then simply calls the appropriate save function before any critical section with respect to the reclaim is started - e.g. lock shared with the reclaim context or when a transaction context nesting would be possible via reclaim. The restore function should be called when the critical section ends. All that ideally along with an explanation what is the reclaim context for easier maintenance.}(hjhj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjhhubh)}(hPlease note that the proper pairing of save/restore functions allows nesting so it is safe to call ``memalloc_noio_save`` or ``memalloc_noio_restore`` respectively from an existing NOIO or NOFS scope.h](hcPlease note that the proper pairing of save/restore functions allows nesting so it is safe to call }(hcPlease note that the proper pairing of save/restore functions allows nesting so it is safe to call hjhhhNhNubj)}(h``memalloc_noio_save``h]hmemalloc_noio_save}(hhhj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh or }(h or hjhhhNhNubj)}(h``memalloc_noio_restore``h]hmemalloc_noio_restore}(hhhj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh2 respectively from an existing NOIO or NOFS scope.}(h2 respectively from an existing NOIO or NOFS scope.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK2hjhhubeh}(h]new-apiah ]h"]new apiah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hWhat about __vmalloc(GFP_NOFS)h]hWhat about __vmalloc(GFP_NOFS)}(hj]hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjXhhhhhK8ubh)}(hX?vmalloc doesn't support GFP_NOFS semantic because there are hardcoded GFP_KERNEL allocations deep inside the allocator which are quite non-trivial to fix up. That means that calling ``vmalloc`` with GFP_NOFS/GFP_NOIO is almost always a bug. The good news is that the NOFS/NOIO semantic can be achieved by the scope API.h](hvmalloc doesn’t support GFP_NOFS semantic because there are hardcoded GFP_KERNEL allocations deep inside the allocator which are quite non-trivial to fix up. That means that calling }(hvmalloc doesn't support GFP_NOFS semantic because there are hardcoded GFP_KERNEL allocations deep inside the allocator which are quite non-trivial to fix up. That means that calling hjihhhNhNubj)}(h ``vmalloc``h]hvmalloc}(hhhjrhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjiubh~ with GFP_NOFS/GFP_NOIO is almost always a bug. The good news is that the NOFS/NOIO semantic can be achieved by the scope API.}(h~ with GFP_NOFS/GFP_NOIO is almost always a bug. The good news is that the NOFS/NOIO semantic can be achieved by the scope API.hjihhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK:hjXhhubh)}(hX_In the ideal world, upper layers should already mark dangerous contexts and so no special care is required and vmalloc should be called without any problems. Sometimes if the context is not really clear or there are layering violations then the recommended way around that is to wrap ``vmalloc`` by the scope API with a comment explaining the problem.h](hXIn the ideal world, upper layers should already mark dangerous contexts and so no special care is required and vmalloc should be called without any problems. Sometimes if the context is not really clear or there are layering violations then the recommended way around that is to wrap }(hXIn the ideal world, upper layers should already mark dangerous contexts and so no special care is required and vmalloc should be called without any problems. Sometimes if the context is not really clear or there are layering violations then the recommended way around that is to wrap hjhhhNhNubj)}(h ``vmalloc``h]hvmalloc}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh8 by the scope API with a comment explaining the problem.}(h8 by the scope API with a comment explaining the problem.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK@hjXhhubeh}(h]what-about-vmalloc-gfp-nofsah ]h"]what about __vmalloc(gfp_nofs)ah$]h&]uh1hhhhhhhhK8ubeh}(h](!gfp-masks-used-from-fs-io-contextheh ]h"](!gfp masks used from fs/io contextgfp_mask_from_fs_ioeh$]h&]uh1hhhhhhhhKexpect_referenced_by_name}jhsexpect_referenced_by_id}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingUTF-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confapep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacefile_insertion_enabled raw_enabledKline_length_limitM'syntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_link embed_imagesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}h]hasnameids}(jhjjjj|jUjRjju nametypes}(jjNjNjUNjNuh}(hhjhj|jMjRjjjjjj%j*jjjjXu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages]hsystem_message)}(hhh]h)}(hhh]h9Hyperlink target "gfp-mask-from-fs-io" is not referenced.}(hhhjP ubah}(h]h ]h"]h$]h&]uh1hhjM ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jK uba transformerN include_log] decorationNhhub.