Hi,
On 2022/9/30 4:38, Rob Clark wrote:
On Thu, Sep 29, 2022 at 4:51 AM Akhil P Oommen <quic_akhilpo@xxxxxxxxxxx> wrote:
On 9/29/2022 3:00 PM, Yang Yingliang wrote:
I got the compile error:
drivers/gpu/drm/msm/msm_gem_shrinker.c: In function ‘can_block’:
drivers/gpu/drm/msm/msm_gem_shrinker.c:29:21: error: ‘__GFP_ATOMIC’ undeclared (first use in this function); did you mean ‘GFP_ATOMIC’?
if (sc->gfp_mask & __GFP_ATOMIC)
^~~~~~~~~~~~
GFP_ATOMIC
drivers/gpu/drm/msm/msm_gem_shrinker.c:29:21: note: each undeclared identifier is reported only once for each function it appears in
__GFP_ATOMIC is dropped by commit 6708fe6bec50 ("mm: discard __GFP_ATOMIC").
Use __GFP_HIGH instead.
Fixes: 025d27239a2f ("drm/msm/gem: Evict active GEM objects when necessary")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
drivers/gpu/drm/msm/msm_gem_shrinker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c b/drivers/gpu/drm/msm/msm_gem_shrinker.c
index 58e0513be5f4..6a0de6cdb82b 100644
--- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
+++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
@@ -26,7 +26,7 @@ static bool can_swap(void)
static bool can_block(struct shrink_control *sc)
{
- if (sc->gfp_mask & __GFP_ATOMIC)
+ if (sc->gfp_mask & __GFP_HIGH)
return false;
return current_is_kswapd() || (sc->gfp_mask & __GFP_RECLAIM);
}
Reviewed-by: Akhil P Oommen <quic_akhilpo@xxxxxxxxxxx>
Somehow the original patch didn't show up in my inbox, but I've sent this:
https://patchwork.freedesktop.org/series/109255/
When __GFP_ATOMIC is not dropped, if __GFP_KSWAPD_RECLAIM is set,
it allows sleep(can_block() returns true).
In your patch case, if __GFP_KSWAPD_RECLAIM is set but
__GFP_DIRECT_RECLAIM is
not set, it don't allows sleep(can_blcok() returns false). It's
different from earlier behavior.
Thanks,
Yang
I guess __GFP_HIGH could also be used to detect GFP_ATOMIC, but
checking that direct reclaim is ok seems safer (ie. it should always
be safe to sleep in that case)
BR,
-R
-Akhil.
.