From LDD3 page 214:
GFP_NOIO
GFP_NOFS
These flags function like GFP_KERNEL, but they add restrictions on what the kernel can do to satisfy the request. A GFP_NOFS allocation is not allowed to perform any filesystem calls, while GFP_NOIO disallows the initiation of any I/O at all. They are used primarily in the filesystem and virtual memory code where an allocation may be allowed to sleep, but recursive filesystem calls would be a bad idea.
I want to know why recursive filesystem calls is a bad idea, when GFP_NOFS is masked?
Thanks!
I want to know why recursive filesystem calls is a bad idea, when GFP_NOFS is masktd?
It's other way around: you use GFP_NOFS
to signal, that allocation can sleep, but can't interact with filesystem ( for example: dump some memory block to disk to make some free memory ). It's done in critical areas of code.
For example: you entered filesystem call, locked some global mutex for this filesystem, called kmalloc. If kmalloc will try to call another filesystem function, that locks the same mutex - we will have deadlock. So we provide GFP_NOFS
flag.