All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cheng Xu <chengxu@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Paul Mckenney <paulmck@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: rt_rq runtime leakage bug fix
Date: Thu, 12 May 2011 18:55:25 +0800	[thread overview]
Message-ID: <4DCBBC9D.7020908@linux.vnet.ibm.com> (raw)
In-Reply-To: <1305195150.2914.268.camel@laptop>

On 5/12/2011 18:12, Peter Zijlstra wrote:
> On Thu, 2011-05-12 at 01:30 +0800, Cheng Xu wrote:
>>
>> I tried but hit a boot-time error "Unable to handle kernel paging
>> request for data at address 0x100000008", and therefore would like to
>> propose an alternative patch like,
>>
> I probably made a silly mistake somehwere, it was after all something
> quickly typed in an email :-)
> 
>> #define for_each_rt_rq(rt_rq, iter, rq) \
>>         for (iter = list_entry_rcu(task_groups.next, typeof(*iter), list); \
>>              (&iter->list != &task_groups) && (rt_rq = iter->rt_rq[cpu_of(rq)]); \
>>              iter = list_entry_rcu(iter->list.next, typeof(*iter), list))
>>
>> This worked, it seems to pass the tests.  Is this correct from a scheduler perspective?
> 
> Creative ;-), it would be nice to know why the , operator version
> doesn't work though, since that looks to be the more conventional way to
> write it.

Yes I am also wondering why it doesn't work. will look into it and get
back to you later.

> 
> That said, I don't see a problem with using your existing on.
> 
>> For the not CONFIG_RT_GROUP_SCHED part, I used 
>>
>> typedef struct rt_rq *rt_rq_iter_t;
>>
>> #define for_each_rt_rq(rt_rq, iter, rq) \
>>         (void) iter; \
>>         for (rt_rq = &rq->rt; rt_rq; rt_rq = NULL)
>>
>> An alternative is 
>> #define for_each_rt_rq(rt_rq, iter, rq) \
>>         for (rt_rq = iter = &rq->rt; iter; rt_rq = iter = NULL)
> 
> Tough call that, the first has a multi-statement macro, which is
> generally discouraged because then:
> 
>   for()
>    for_each_rt_rq() {
>    }
> 
> will not work as expected, so I think we want the second version.

Agree, I realized this problem soon after sending out the email
yesterday, :) and improved it to be

#define for_each_rt_rq(rt_rq, iter, rq) \
	for ((void) iter, rt_rq = &rq->rt; rt_rq; rt_rq = NULL)

maybe we can still use it?

> 
>> The patch is attached below. Could you check whether it is workable? Thank you. 
> 
> Yes, given how things are I can't really see it getting any better,
> thanks!
> 

I have updated the patch content according to the comments, and done
part of the test. will send out the complete second version for your
review soon.

Thank you very much!

> --
> 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/



  reply	other threads:[~2011-05-12 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  7:34 [PATCH] sched: rt_rq runtime leakage bug fix Cheng Xu
2011-05-11  9:21 ` Peter Zijlstra
2011-05-11 17:30   ` Cheng Xu
2011-05-12 10:12     ` Peter Zijlstra
2011-05-12 10:55       ` Cheng Xu [this message]
2011-05-12 11:27         ` Peter Zijlstra
2011-05-14  5:48       ` Cheng Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DCBBC9D.7020908@linux.vnet.ibm.com \
    --to=chengxu@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.