Ԉsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/core-api/gfp_mask-from-fs-iomodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(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}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh field_list)}(hhh](hfield)}(hhh](h field_name)}(hDateh]hDate}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhKubh field_body)}(h May, 2018h]h paragraph)}(hhh]h May, 2018}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hAuthorh]hAuthor}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhKubh)}(h!Michal Hocko h]h)}(h Michal Hocko h](hMichal Hocko <}(hjhhhNhNubh reference)}(hmhocko@kernel.orgh]hmhocko@kernel.org}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurimailto:mhocko@kernel.orguh1jhjubh>}(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}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjKhhhhhK 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\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjKhhubh)}(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.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjKhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hNew APIh]hNew API}(hjhhhNhNubah}(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 }(hjhhhNhNubhliteral)}(h``memalloc_nofs_save``h]hmemalloc_nofs_save}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h``memalloc_nofs_restore``h]hmemalloc_nofs_restore}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh respectively }(hjhhhNhNubj)}(h``memalloc_noio_save``h]hmemalloc_noio_save}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, }(hjhhhNhNubj)}(h``memalloc_noio_restore``h]hmemalloc_noio_restore}(hjhhhNhNubah}(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.}(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}(hj hhhNhNubah}(h]h ]ktah"]h$]h&]uh1j hjhhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMubhdesc_sig_space)}(h h]h }(hjhhhNhNubah}(h]h ]wah"]h$]h&]uh1jhjhhhjhMubj )}(hinth]hint}(hj.hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjhhhjhMubj)}(h h]h }(hj<hhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjhhhjhMubh desc_name)}(hmemalloc_nofs_saveh]h desc_sig_name)}(hmemalloc_nofs_saveh]hmemalloc_nofs_save}(hjRhhhNhNubah}(h]h ]nah"]h$]h&]uh1jPhjLubah}(h]h ](sig-namedescnameeh"]h$]h&] xml:spacepreserveuh1jJhjhhhjhMubhdesc_parameterlist)}(h(void)h]hdesc_parameter)}(hvoidh]j )}(hvoidh]hvoid}(hjwhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjsubah}(h]h ]h"]h$]h&]noemphjijjuh1jqhjmubah}(h]h ]h"]h$]h&]jijjuh1jkhjhhhjhMubeh}(h]h ]h"]h$]h&]jijj add_permalinkuh1jsphinx_line_type declaratorhjhhhjhMubah}(h]jah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1jhjhMhjhhubh desc_content)}(hhh]h)}(h)Marks implicit GFP_NOFS allocation scope.h]h)Marks implicit GFP_NOFS allocation scope.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMuhjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhMubeh}(h]h ](cfunctioneh"]h$]h&]domainjobjtypejdesctypejnoindex noindexentrynocontentsentryuh1jhhhjhNhNubh 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}(hjhhhNhNubah}(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.hhMyhjubhdefinition_list)}(hhh]hdefinition_list_item)}(h``void`` no arguments h](hterm)}(h``void``h]j)}(hjh]hvoid}(hjhhhNhNubah}(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.hhM|hjubh definition)}(hhh]h)}(h no argumentsh]h no arguments}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM|hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhM|hjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hj:h]h Description}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj8ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhM~hjubh)}(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.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMvhjubh)}(h **Context**h]j)}(hjah]hContext}(hjchhhNhNubah}(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.hhM|hjubh)}(h2This function is safe to be used from any context.h]h2This function is safe to be used from any context.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhM}hjubh)}(h **Return**h]j)}(hjh]hReturn}(hjhhhNhNubah}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhM~hjubeh}(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}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjhhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMubj)}(h h]h }(hjhhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjhhhjhMubjK)}(hmemalloc_nofs_restoreh]jQ)}(hmemalloc_nofs_restoreh]hmemalloc_nofs_restore}(hjhhhNhNubah}(h]h ]j]ah"]h$]h&]uh1jPhjubah}(h]h ](jdjeeh"]h$]h&]jijjuh1jJhjhhhjhMubjl)}(h(unsigned int flags)h]jr)}(hunsigned int flagsh](j )}(hunsignedh]hunsigned}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hjhhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjubj )}(hinth]hint}(hj&hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hj4hhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjubjQ)}(hflagsh]hflags}(hjBhhhNhNubah}(h]h ]j]ah"]h$]h&]uh1jPhjubeh}(h]h ]h"]h$]h&]noemphjijjuh1jqhjubah}(h]h ]h"]h$]h&]jijjuh1jkhjhhhjhMubeh}(h]h ]h"]h$]h&]jijjjuh1jjjhjhhhjhMubah}(h]jah ](jjeh"]h$]h&]jj)jhuh1jhjhMhjhhubj)}(hhh]h)}(h!Ends the implicit GFP_NOFS scope.h]h!Ends the implicit GFP_NOFS scope.}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:38: ./include/linux/sched/mm.hhMhjihhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhMubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1jhhhjhNhNubj)}(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}(hjhhhNhNubah}(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}(hjhhhNhNubah}(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.}(hjhhhNhNubah}(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}(hjhhhNhNubah}(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.}(hjhhhNhNubah}(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}(hj-hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj)hhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMbubj)}(h h]h }(hj<hhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhj)hhhj;hMbubj )}(hinth]hint}(hjJhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj)hhhj;hMbubj)}(h h]h }(hjXhhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhj)hhhj;hMbubjK)}(hmemalloc_noio_saveh]jQ)}(hmemalloc_noio_saveh]hmemalloc_noio_save}(hjjhhhNhNubah}(h]h ]j]ah"]h$]h&]uh1jPhjfubah}(h]h ](jdjeeh"]h$]h&]jijjuh1jJhj)hhhj;hMbubjl)}(h(void)h]jr)}(hvoidh]j )}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&]noemphjijjuh1jqhj~ubah}(h]h ]h"]h$]h&]jijjuh1jkhj)hhhj;hMbubeh}(h]h ]h"]h$]h&]jijjjuh1jjjhj%hhhj;hMbubah}(h]j ah ](jjeh"]h$]h&]jj)jhuh1jhj;hMbhj"hhubj)}(hhh]h)}(h)Marks implicit GFP_NOIO allocation scope.h]h)Marks implicit GFP_NOIO allocation scope.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMWhjhhubah}(h]h ]h"]h$]h&]uh1jhj"hhhj;hMbubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjjjjuh1jhhhjhNhNubj)}(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}(hjhhhNhNubah}(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``void`` no arguments h](j)}(h``void``h]j)}(hjh]hvoid}(hjhhhNhNubah}(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.hhM^hjubj)}(hhh]h)}(h no argumentsh]h no arguments}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhM^hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhM^hjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hj,h]h Description}(hj.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:40: ./include/linux/sched/mm.hhM`hjubh)}(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.}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMXhjubh)}(h **Context**h]j)}(hjSh]hContext}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjQubah}(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)}(h2This function is safe to be used from any context.h]h2This function is safe to be used from any context.}(hjihhhNhNubah}(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)}(h **Return**h]j)}(hjzh]hReturn}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjxubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMahjubh)}(h6The saved flags to be passed to memalloc_noio_restore.h]h6The saved flags to be passed to memalloc_noio_restore.}(hjhhhNhNubah}(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&]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}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjhhhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMoubj)}(h h]h }(hjhhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjhhhjhMoubjK)}(hmemalloc_noio_restoreh]jQ)}(hmemalloc_noio_restoreh]hmemalloc_noio_restore}(hjhhhNhNubah}(h]h ]j]ah"]h$]h&]uh1jPhjubah}(h]h ](jdjeeh"]h$]h&]jijjuh1jJhjhhhjhMoubjl)}(h(unsigned int flags)h]jr)}(hunsigned int flagsh](j )}(hunsignedh]hunsigned}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hj hhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjubj )}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubj)}(h h]h }(hj&hhhNhNubah}(h]h ]j*ah"]h$]h&]uh1jhjubjQ)}(hflagsh]hflags}(hj4hhhNhNubah}(h]h ]j]ah"]h$]h&]uh1jPhjubeh}(h]h ]h"]h$]h&]noemphjijjuh1jqhjubah}(h]h ]h"]h$]h&]jijjuh1jkhjhhhjhMoubeh}(h]h ]h"]h$]h&]jijjjuh1jjjhjhhhjhMoubah}(h]jah ](jjeh"]h$]h&]jj)jhuh1jhjhMohjhhubj)}(hhh]h)}(h!Ends the implicit GFP_NOIO scope.h]h!Ends the implicit GFP_NOIO scope.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMhhj[hhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhMoubeh}(h]h ](jfunctioneh"]h$]h&]jjjjvjjvjjjuh1jhhhjhNhNubj)}(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}(hjhhhNhNubah}(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.hhMlhjzubj)}(hhh]j)}(h)``unsigned int flags`` Flags to restore. h](j)}(h``unsigned int flags``h]j)}(hjh]hunsigned int flags}(hjhhhNhNubah}(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.hhMihjubj)}(hhh]h)}(hFlags to restore.h]hFlags to restore.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhMihjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhMihjubah}(h]h ]h"]h$]h&]uh1jhjzubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(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.hhMkhjzubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/core-api/gfp_mask-from-fs-io:40: ./include/linux/sched/mm.hhMkhjzubeh}(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.}(hjhhhNhNubah}(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 }(hjhhhNhNubj)}(h``memalloc_noio_save``h]hmemalloc_noio_save}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh or }(hjhhhNhNubj)}(h``memalloc_noio_restore``h]hmemalloc_noio_restore}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh2 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)}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjNhhhhhK8ubh)}(hSince v5.17, and specifically after the commit 451769ebb7e79 ("mm/vmalloc: alloc GFP_NO{FS,IO} for vmalloc"), GFP_NOFS/GFP_NOIO are now supported in ``[k]vmalloc`` by implicitly using scope API.h](hSince v5.17, and specifically after the commit 451769ebb7e79 (“mm/vmalloc: alloc GFP_NO{FS,IO} for vmalloc”), GFP_NOFS/GFP_NOIO are now supported in }(hj_hhhNhNubj)}(h``[k]vmalloc``h]h [k]vmalloc}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1jhj_ubh by implicitly using scope API.}(hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK:hjNhhubh)}(hIn earlier kernels ``vmalloc`` didn't support GFP_NOFS semantic because there were hardcoded GFP_KERNEL allocations deep inside the allocator. That means that calling ``vmalloc`` with GFP_NOFS/GFP_NOIO was almost always a bug.h](hIn earlier kernels }(hjhhhNhNubj)}(h ``vmalloc``h]hvmalloc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh didn’t support GFP_NOFS semantic because there were hardcoded GFP_KERNEL allocations deep inside the allocator. That means that calling }(hjhhhNhNubj)}(h ``vmalloc``h]hvmalloc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh0 with GFP_NOFS/GFP_NOIO was almost always a bug.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK>hjNhhubh)}(hXzIn 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 (on pre-v5.17 kernels) is to wrap ``vmalloc`` by the scope API with a comment explaining the problem.h](hoIn the ideal world, upper layers should already mark dangerous contexts and so no special care is required and }(hjhhhNhNubj)}(h ``vmalloc``h]hvmalloc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh 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 (on pre-v5.17 kernels) is to wrap }(hjhhhNhNubj)}(h ``vmalloc``h]hvmalloc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh8 by the scope API with a comment explaining the problem.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKBhjNhhubeh}(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_handlerj error_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.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_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_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}h]hasnameids}(jhjjj}jzjKjHjju nametypes}(jjj}jKjuh}(hhjhjzjKjHjjjjjj j%jjjjNu 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.}hj sbah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1j uba transformerN include_log] decorationNhhub.