public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] cfs: NULL pointer check
  2011-09-16 17:48 [PATCH] cfs: NULL pointer check Wang Xingchao
@ 2011-09-16  5:57 ` Yong Zhang
  2011-09-16  7:42 ` Paul Turner
  1 sibling, 0 replies; 4+ messages in thread
From: Yong Zhang @ 2011-09-16  5:57 UTC (permalink / raw)
  To: Wang Xingchao; +Cc: linux-kernel, mingo, peterz, alex.shi

On Fri, Sep 16, 2011 at 01:48:53PM -0400, Wang Xingchao wrote:
> se maybe NULL if cfs_rq->rb_leftmost is NULL

I don't think se could be NULL here. Because we call check_preempt_tick()
iff 'cfs_rq->nr_running > 1'.

Thanks,
Yong

> 
> Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
> ---
>  kernel/sched_fair.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index fef0bfd..109b232 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -1130,6 +1130,10 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
>  		return;
>  
>  	se = __pick_first_entity(cfs_rq);
> +
> +	if (!se)
> +		return;
> +
>  	delta = curr->vruntime - se->vruntime;
>  
>  	if (delta < 0)
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Only stand for myself

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

* Re: [PATCH] cfs: NULL pointer check
  2011-09-16 17:48 [PATCH] cfs: NULL pointer check Wang Xingchao
  2011-09-16  5:57 ` Yong Zhang
@ 2011-09-16  7:42 ` Paul Turner
  2011-09-16 21:18   ` xingchao
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Turner @ 2011-09-16  7:42 UTC (permalink / raw)
  To: Wang Xingchao; +Cc: linux-kernel, mingo, peterz, yong.zhang0, alex.shi

On 09/16/11 10:48, Wang Xingchao wrote:
> se maybe NULL if cfs_rq->rb_leftmost is NULL

nack, it had better not be; otherwise we've got a corrupt tree!

Also, this diff is against the previous -- please bundle dependent 
patches as a series in the future.

Thanks,

- Paul


>
> Signed-off-by: Wang Xingchao<xingchao.wang@intel.com>
> ---
>   kernel/sched_fair.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index fef0bfd..109b232 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -1130,6 +1130,10 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
>   		return;
>
>   	se = __pick_first_entity(cfs_rq);
> +
> +	if (!se)
> +		return;
> +
>   	delta = curr->vruntime - se->vruntime;
>
>   	if (delta<  0)


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

* [PATCH] cfs: NULL pointer check
@ 2011-09-16 17:48 Wang Xingchao
  2011-09-16  5:57 ` Yong Zhang
  2011-09-16  7:42 ` Paul Turner
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Xingchao @ 2011-09-16 17:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, peterz, yong.zhang0, alex.shi, Wang Xingchao

se maybe NULL if cfs_rq->rb_leftmost is NULL

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
---
 kernel/sched_fair.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index fef0bfd..109b232 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1130,6 +1130,10 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
 		return;
 
 	se = __pick_first_entity(cfs_rq);
+
+	if (!se)
+		return;
+
 	delta = curr->vruntime - se->vruntime;
 
 	if (delta < 0)
-- 
1.7.1


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

* Re: [PATCH] cfs: NULL pointer check
  2011-09-16  7:42 ` Paul Turner
@ 2011-09-16 21:18   ` xingchao
  0 siblings, 0 replies; 4+ messages in thread
From: xingchao @ 2011-09-16 21:18 UTC (permalink / raw)
  To: Paul Turner
  Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, peterz@infradead.org,
	yong.zhang0@gmail.com, Shi, Alex

On Fri, 16 Sep 2011 15:42:41 +0800
Paul Turner <pjt@google.com> wrote:

> On 09/16/11 10:48, Wang Xingchao wrote:
> > se maybe NULL if cfs_rq->rb_leftmost is NULL
> 
> nack, it had better not be; otherwise we've got a corrupt tree!
> 
> Also, this diff is against the previous -- please bundle dependent 
> patches as a series in the future.
> 
Got it.  :)
Paul, i'd send another patch to remove the NULL pointer check
in __pick_first/last_entity().

--xingchao

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

end of thread, other threads:[~2011-09-16  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-16 17:48 [PATCH] cfs: NULL pointer check Wang Xingchao
2011-09-16  5:57 ` Yong Zhang
2011-09-16  7:42 ` Paul Turner
2011-09-16 21:18   ` xingchao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox