2012-08-17 04:33:44

by Michael wang

[permalink] [raw]
Subject: [PATCH 2/3] kmemleak: replace list_for_each_continue_rcu with new interface

From: Michael Wang <[email protected]>

This patch replaces list_for_each_continue_rcu() with
list_for_each_entry_continue_rcu() to save a few lines
of code and allow removing list_for_each_continue_rcu().

Signed-off-by: Michael Wang <[email protected]>
---
mm/kmemleak.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 45eb621..0de83b4 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1483,13 +1483,11 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct kmemleak_object *prev_obj = v;
struct kmemleak_object *next_obj = NULL;
- struct list_head *n = &prev_obj->object_list;
+ struct kmemleak_object *obj = prev_obj;

++(*pos);

- list_for_each_continue_rcu(n, &object_list) {
- struct kmemleak_object *obj =
- list_entry(n, struct kmemleak_object, object_list);
+ list_for_each_entry_continue_rcu(obj, &object_list, object_list) {
if (get_object(obj)) {
next_obj = obj;
break;
--
1.7.4.1


2012-08-21 00:02:43

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH 2/3] kmemleak: replace list_for_each_continue_rcu with new interface

On Fri, Aug 17, 2012 at 12:33:34PM +0800, Michael Wang wrote:
> From: Michael Wang <[email protected]>
>
> This patch replaces list_for_each_continue_rcu() with
> list_for_each_entry_continue_rcu() to save a few lines
> of code and allow removing list_for_each_continue_rcu().
>
> Signed-off-by: Michael Wang <[email protected]>

Reviewed-by: Paul E. McKenney <[email protected]>

> ---
> mm/kmemleak.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index 45eb621..0de83b4 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -1483,13 +1483,11 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> {
> struct kmemleak_object *prev_obj = v;
> struct kmemleak_object *next_obj = NULL;
> - struct list_head *n = &prev_obj->object_list;
> + struct kmemleak_object *obj = prev_obj;
>
> ++(*pos);
>
> - list_for_each_continue_rcu(n, &object_list) {
> - struct kmemleak_object *obj =
> - list_entry(n, struct kmemleak_object, object_list);
> + list_for_each_entry_continue_rcu(obj, &object_list, object_list) {
> if (get_object(obj)) {
> next_obj = obj;
> break;
> --
> 1.7.4.1
>
>

2012-08-24 00:53:05

by Michael wang

[permalink] [raw]
Subject: Re: [PATCH 2/3] kmemleak: replace list_for_each_continue_rcu with new interface

On 08/17/2012 12:33 PM, Michael Wang wrote:
> From: Michael Wang <[email protected]>
>
> This patch replaces list_for_each_continue_rcu() with
> list_for_each_entry_continue_rcu() to save a few lines
> of code and allow removing list_for_each_continue_rcu().

Hi, Catalin

Could I get some comments on this patch?

Regards,
Michael Wang

>
> Signed-off-by: Michael Wang <[email protected]>
> ---
> mm/kmemleak.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index 45eb621..0de83b4 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -1483,13 +1483,11 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> {
> struct kmemleak_object *prev_obj = v;
> struct kmemleak_object *next_obj = NULL;
> - struct list_head *n = &prev_obj->object_list;
> + struct kmemleak_object *obj = prev_obj;
>
> ++(*pos);
>
> - list_for_each_continue_rcu(n, &object_list) {
> - struct kmemleak_object *obj =
> - list_entry(n, struct kmemleak_object, object_list);
> + list_for_each_entry_continue_rcu(obj, &object_list, object_list) {
> if (get_object(obj)) {
> next_obj = obj;
> break;
>

2012-08-24 10:05:43

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH 2/3] kmemleak: replace list_for_each_continue_rcu with new interface

On Fri, Aug 24, 2012 at 01:52:50AM +0100, Michael Wang wrote:
> On 08/17/2012 12:33 PM, Michael Wang wrote:
> > From: Michael Wang <[email protected]>
> >
> > This patch replaces list_for_each_continue_rcu() with
> > list_for_each_entry_continue_rcu() to save a few lines
> > of code and allow removing list_for_each_continue_rcu().
>
> Could I get some comments on this patch?

Sorry, busy with other things and forgot about this.

Acked-by: Catalin Marinas <[email protected]>

2012-08-24 19:54:21

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH 2/3] kmemleak: replace list_for_each_continue_rcu with new interface

On Fri, Aug 24, 2012 at 11:05:05AM +0100, Catalin Marinas wrote:
> On Fri, Aug 24, 2012 at 01:52:50AM +0100, Michael Wang wrote:
> > On 08/17/2012 12:33 PM, Michael Wang wrote:
> > > From: Michael Wang <[email protected]>
> > >
> > > This patch replaces list_for_each_continue_rcu() with
> > > list_for_each_entry_continue_rcu() to save a few lines
> > > of code and allow removing list_for_each_continue_rcu().
> >
> > Could I get some comments on this patch?
>
> Sorry, busy with other things and forgot about this.
>
> Acked-by: Catalin Marinas <[email protected]>

Queued, thank you both!

Thanx, Paul