Commit cf23e30
mm, percpu: do not consider sleepable allocations atomic
[ Upstream commit 9a5b183 ]
28307d9 ("percpu: make pcpu_alloc() aware of current gfp context")
has fixed a reclaim recursion for scoped GFP_NOFS context. It has done
that by avoiding taking pcpu_alloc_mutex. This is a correct solution as
the worker context with full GFP_KERNEL allocation/reclaim power and which
is using the same lock cannot block the NOFS pcpu_alloc caller.
On the other hand this is a very conservative approach that could lead to
failures because pcpu_alloc lockless implementation is quite limited.
We have a bug report about premature failures when scsi array of 193
devices is scanned. Sometimes (not consistently) the scanning aborts
because the iscsid daemon fails to create the queue for a random scsi
device during the scan. iscsid itself is running with PR_SET_IO_FLUSHER
set so all allocations from this process context are GFP_NOIO. This in
turn makes any pcpu_alloc lockless (without pcpu_alloc_mutex) which leads
to pre-mature failures.
It has turned out that iscsid has worked around this by dropping
PR_SET_IO_FLUSHER (open-iscsi/open-iscsi#382) when
scanning host. But we can do better in this case on the kernel side and
use pcpu_alloc_mutex for NOIO resp. NOFS constrained allocation scopes
too. We just need the WQ worker to never trigger IO/FS reclaim. Achieve
that by enforcing scoped GFP_NOIO for the whole execution of
pcpu_balance_workfn (this will imply NOFS constrain as well). This will
remove the dependency chain and preserve the full allocation power of the
pcpu_alloc call.
While at it make is_atomic really test for blockable allocations.
Link: https://lkml.kernel.org/r/20250206122633.167896-1-mhocko@kernel.org
Fixes: 28307d9 ("percpu: make pcpu_alloc() aware of current gfp context")
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Filipe David Manana <fdmanana@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: chenxin <chenxinxin@xiaomi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 34c93e96c3a3a26716d3b8a2f32c10e2bab8e7be)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>1 parent 72cc85e commit cf23e30
1 file changed
+7
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1758 | 1758 | | |
1759 | 1759 | | |
1760 | 1760 | | |
1761 | | - | |
| 1761 | + | |
1762 | 1762 | | |
1763 | 1763 | | |
1764 | 1764 | | |
| |||
2203 | 2203 | | |
2204 | 2204 | | |
2205 | 2205 | | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
2206 | 2210 | | |
| 2211 | + | |
2207 | 2212 | | |
2208 | 2213 | | |
2209 | 2214 | | |
| |||
2214 | 2219 | | |
2215 | 2220 | | |
2216 | 2221 | | |
| 2222 | + | |
2217 | 2223 | | |
2218 | 2224 | | |
2219 | 2225 | | |
| |||
0 commit comments