* [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking
@ 2010-09-05 18:33 Kulikov Vasiliy
2010-09-05 22:00 ` David Rientjes
2010-09-06 0:48 ` KOSAKI Motohiro
0 siblings, 2 replies; 4+ messages in thread
From: Kulikov Vasiliy @ 2010-09-05 18:33 UTC (permalink / raw)
To: kernel-janitors
Cc: Vasiliy Kulikov, Andrew Morton, KOSAKI Motohiro, David Rientjes,
Minchan Kim, KAMEZAWA Hiroyuki, linux-kernel, linux-mm
From: Vasiliy Kulikov <segooon@gmail.com>
Use IS_ERR() instead of strict checking.
Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
Compile tested.
mm/oom_kill.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index fc81cb2..2ee3350 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -514,7 +514,7 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
read_lock(&tasklist_lock);
retry:
p = select_bad_process(&points, limit, mem, NULL);
- if (!p || PTR_ERR(p) == -1UL)
+ if (IS_ERR_OR_NULL(p))
goto out;
if (oom_kill_process(p, gfp_mask, 0, points, limit, mem, NULL,
@@ -691,7 +691,7 @@ retry:
p = select_bad_process(&points, totalpages, NULL,
constraint == CONSTRAINT_MEMORY_POLICY ? nodemask :
NULL);
- if (PTR_ERR(p) == -1UL)
+ if (IS_ERR(p))
goto out;
/* Found nothing?!?! Either we hang forever, or we panic. */
--
1.7.0.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking
2010-09-05 18:33 [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking Kulikov Vasiliy
@ 2010-09-05 22:00 ` David Rientjes
2010-09-06 0:48 ` KOSAKI Motohiro
1 sibling, 0 replies; 4+ messages in thread
From: David Rientjes @ 2010-09-05 22:00 UTC (permalink / raw)
To: Kulikov Vasiliy
Cc: kernel-janitors, Andrew Morton, KOSAKI Motohiro, Minchan Kim,
KAMEZAWA Hiroyuki, linux-kernel, linux-mm
On Sun, 5 Sep 2010, Kulikov Vasiliy wrote:
> From: Vasiliy Kulikov <segooon@gmail.com>
>
> Use IS_ERR() instead of strict checking.
>
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Acked-by: David Rientjes <rientjes@google.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking
2010-09-05 18:33 [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking Kulikov Vasiliy
2010-09-05 22:00 ` David Rientjes
@ 2010-09-06 0:48 ` KOSAKI Motohiro
2010-09-06 8:59 ` David Rientjes
1 sibling, 1 reply; 4+ messages in thread
From: KOSAKI Motohiro @ 2010-09-06 0:48 UTC (permalink / raw)
To: Kulikov Vasiliy
Cc: kosaki.motohiro, kernel-janitors, Andrew Morton, David Rientjes,
Minchan Kim, KAMEZAWA Hiroyuki, linux-kernel, linux-mm
> From: Vasiliy Kulikov <segooon@gmail.com>
>
> Use IS_ERR() instead of strict checking.
Umm...
I don't like this. IS_ERR() imply an argument is error code. but in
this case, we don't use error code. -1 mean oom special purpose meaning
value.
So, if we take this direction, It would be better to use EAGAIN or something
instead -1.
>
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> ---
> Compile tested.
>
> mm/oom_kill.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index fc81cb2..2ee3350 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -514,7 +514,7 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
> read_lock(&tasklist_lock);
> retry:
> p = select_bad_process(&points, limit, mem, NULL);
> - if (!p || PTR_ERR(p) == -1UL)
> + if (IS_ERR_OR_NULL(p))
> goto out;
>
> if (oom_kill_process(p, gfp_mask, 0, points, limit, mem, NULL,
> @@ -691,7 +691,7 @@ retry:
> p = select_bad_process(&points, totalpages, NULL,
> constraint == CONSTRAINT_MEMORY_POLICY ? nodemask :
> NULL);
> - if (PTR_ERR(p) == -1UL)
> + if (IS_ERR(p))
> goto out;
>
> /* Found nothing?!?! Either we hang forever, or we panic. */
> --
> 1.7.0.4
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking
2010-09-06 0:48 ` KOSAKI Motohiro
@ 2010-09-06 8:59 ` David Rientjes
0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2010-09-06 8:59 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: Kulikov Vasiliy, kernel-janitors, Andrew Morton, Minchan Kim,
KAMEZAWA Hiroyuki, linux-kernel, linux-mm
On Mon, 6 Sep 2010, KOSAKI Motohiro wrote:
> > From: Vasiliy Kulikov <segooon@gmail.com>
> >
> > Use IS_ERR() instead of strict checking.
>
> Umm...
>
> I don't like this. IS_ERR() imply an argument is error code. but in
> this case, we don't use error code. -1 mean oom special purpose meaning
> value.
>
You could make the same argument by saying the current use of PTR_ERR()
implies an error code. We've simply hijacked -1UL for simplicity in this
case and because select_bad_process() can only return one other value
besides a pointer to a process or NULL.
> So, if we take this direction, It would be better to use EAGAIN or something
> instead -1.
>
I agree it would probably better to return ERR_PTR(-EAGAIN) instead of
using -1UL.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-06 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-05 18:33 [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking Kulikov Vasiliy
2010-09-05 22:00 ` David Rientjes
2010-09-06 0:48 ` KOSAKI Motohiro
2010-09-06 8:59 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox