All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] drm/msm/msm_gem_shrinker: fix compile error in can_block()
@ 2022-09-29  9:30 Yang Yingliang
  2022-09-29 11:51 ` [Freedreno] " Akhil P Oommen
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Yingliang @ 2022-09-29  9:30 UTC (permalink / raw)
  To: dri-devel, freedreno

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@huawei.com>
---
 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);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Freedreno] [PATCH -next] drm/msm/msm_gem_shrinker: fix compile error in can_block()
  2022-09-29  9:30 [PATCH -next] drm/msm/msm_gem_shrinker: fix compile error in can_block() Yang Yingliang
@ 2022-09-29 11:51 ` Akhil P Oommen
  2022-09-29 20:38   ` Rob Clark
  0 siblings, 1 reply; 4+ messages in thread
From: Akhil P Oommen @ 2022-09-29 11:51 UTC (permalink / raw)
  To: Yang Yingliang, dri-devel, freedreno

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@huawei.com>
> ---
>   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@quicinc.com>


-Akhil.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Freedreno] [PATCH -next] drm/msm/msm_gem_shrinker: fix compile error in can_block()
  2022-09-29 11:51 ` [Freedreno] " Akhil P Oommen
@ 2022-09-29 20:38   ` Rob Clark
  2022-09-30  1:48     ` Yang Yingliang
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Clark @ 2022-09-29 20:38 UTC (permalink / raw)
  To: Akhil P Oommen; +Cc: freedreno, dri-devel, Yang Yingliang

On Thu, Sep 29, 2022 at 4:51 AM Akhil P Oommen <quic_akhilpo@quicinc.com> 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@huawei.com>
> > ---
> >   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@quicinc.com>
>

Somehow the original patch didn't show up in my inbox, but I've sent this:

https://patchwork.freedesktop.org/series/109255/

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Freedreno] [PATCH -next] drm/msm/msm_gem_shrinker: fix compile error in can_block()
  2022-09-29 20:38   ` Rob Clark
@ 2022-09-30  1:48     ` Yang Yingliang
  0 siblings, 0 replies; 4+ messages in thread
From: Yang Yingliang @ 2022-09-30  1:48 UTC (permalink / raw)
  To: Rob Clark, Akhil P Oommen; +Cc: freedreno, dri-devel, yangyingliang

Hi,

On 2022/9/30 4:38, Rob Clark wrote:
> On Thu, Sep 29, 2022 at 4:51 AM Akhil P Oommen <quic_akhilpo@quicinc.com> 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@huawei.com>
>>> ---
>>>    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@quicinc.com>
>>
> 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.
> .

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-30  1:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29  9:30 [PATCH -next] drm/msm/msm_gem_shrinker: fix compile error in can_block() Yang Yingliang
2022-09-29 11:51 ` [Freedreno] " Akhil P Oommen
2022-09-29 20:38   ` Rob Clark
2022-09-30  1:48     ` Yang Yingliang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.