linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] jffs2: use cond_resched() instead of yield()
@ 2010-09-01 16:03 Wolfram Sang
  2010-09-01 18:35 ` Artem Bityutskiy
  2010-09-20 13:00 ` Artem Bityutskiy
  0 siblings, 2 replies; 6+ messages in thread
From: Wolfram Sang @ 2010-09-01 16:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Artem Bityutskiy, Ingo Molnar, linux-mtd, Wolfram Sang

yield() has different semantics meanwhile and even causes RT-kernels to
BUG. Replace the only appearance left in jffs2.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Ingo Molnar <mingo@elte.hu>
---

The aforementioned BUG() showed up in one of our customer's RT-projects. While
this could be handled by rearranging his thread-priorities, I wondered if such
a patch would be worthwhile, still. Reading through the material covering
yield() and related replacements, I believe this patch should be appropriate.
Please say if I missed some side-effects.

 fs/jffs2/erase.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index abac961..e513f19 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -151,7 +151,7 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
 		}
 
 		/* Be nice */
-		yield();
+		cond_resched();
 		mutex_lock(&c->erase_free_sem);
 		spin_lock(&c->erase_completion_lock);
 	}
-- 
1.7.1

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

* Re: [RFC] jffs2: use cond_resched() instead of yield()
  2010-09-01 16:03 [RFC] jffs2: use cond_resched() instead of yield() Wolfram Sang
@ 2010-09-01 18:35 ` Artem Bityutskiy
  2010-09-02  7:01   ` Joakim Tjernlund
  2010-09-20 13:00 ` Artem Bityutskiy
  1 sibling, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2010-09-01 18:35 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Artem Bityutskiy, Ingo Molnar, dwmw2, linux-mtd, linux-kernel

This 'yield()' was introduced by dwmw2, so he may have strong feelings
about it. CCed.

On Wed, 2010-09-01 at 18:03 +0200, Wolfram Sang wrote:
> yield() has different semantics meanwhile and even causes RT-kernels to
> BUG. Replace the only appearance left in jffs2.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
> 
> The aforementioned BUG() showed up in one of our customer's RT-projects. While
> this could be handled by rearranging his thread-priorities, I wondered if such
> a patch would be worthwhile, still. Reading through the material covering
> yield() and related replacements, I believe this patch should be appropriate.
> Please say if I missed some side-effects.
> 
>  fs/jffs2/erase.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
> index abac961..e513f19 100644
> --- a/fs/jffs2/erase.c
> +++ b/fs/jffs2/erase.c
> @@ -151,7 +151,7 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
>  		}
>  
>  		/* Be nice */
> -		yield();
> +		cond_resched();
>  		mutex_lock(&c->erase_free_sem);
>  		spin_lock(&c->erase_completion_lock);
>  	}

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [RFC] jffs2: use cond_resched() instead of yield()
  2010-09-01 18:35 ` Artem Bityutskiy
@ 2010-09-02  7:01   ` Joakim Tjernlund
  2010-09-02 10:59     ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Joakim Tjernlund @ 2010-09-02  7:01 UTC (permalink / raw)
  To: dedekind1
  Cc: Artem Bityutskiy, linux-kernel, Wolfram Sang, linux-mtd,
	Ingo Molnar, dwmw2

>
> This 'yield()' was introduced by dwmw2, so he may have strong feelings
> about it. CCed.

Actually, it was introduced by me with commit fd5324909e410a3202c1b01bd507c2dfba58fca5 :

[JFFS2] Fix hanging close for /dev/mtd character device.

    When pdflush is erasing lots of sectors, drivers calling
    mtd->sync will hang until all blocks are erased. Be nicer.

    Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
    Signed-off-by: David Woodhouse <dwmw2@infradead.org>


@@ -142,7 +142,7 @@ void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
 		}

 		/* Be nice */
-		cond_resched();
+		yield();
 		spin_lock(&c->erase_completion_lock);
 	}

At the time cond_resched() was a problem but now I don't know. The erasing
has moved to the GC thread and been somewhat reworked. I don't know if
it still needs yield(). Perhaps David can tell?

    Jocke
>
> On Wed, 2010-09-01 at 18:03 +0200, Wolfram Sang wrote:
> > yield() has different semantics meanwhile and even causes RT-kernels to
> > BUG. Replace the only appearance left in jffs2.
> >
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > ---
> >
> > The aforementioned BUG() showed up in one of our customer's RT-projects. While
> > this could be handled by rearranging his thread-priorities, I wondered if such
> > a patch would be worthwhile, still. Reading through the material covering
> > yield() and related replacements, I believe this patch should be appropriate.
> > Please say if I missed some side-effects.
> >
> >  fs/jffs2/erase.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
> > index abac961..e513f19 100644
> > --- a/fs/jffs2/erase.c
> > +++ b/fs/jffs2/erase.c
> > @@ -151,7 +151,7 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
> >        }
> >
> >        /* Be nice */
> > -      yield();
> > +      cond_resched();
> >        mutex_lock(&c->erase_free_sem);
> >        spin_lock(&c->erase_completion_lock);
> >     }
>
> --
> Best Regards,
> Artem Bityutskiy (Битюцкий Артём)
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [RFC] jffs2: use cond_resched() instead of yield()
  2010-09-02  7:01   ` Joakim Tjernlund
@ 2010-09-02 10:59     ` Artem Bityutskiy
  2010-09-02 13:52       ` Joakim Tjernlund
  0 siblings, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2010-09-02 10:59 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: Artem Bityutskiy, linux-kernel, Wolfram Sang, linux-mtd,
	Ingo Molnar, dwmw2

On Thu, 2010-09-02 at 09:01 +0200, Joakim Tjernlund wrote:
> At the time cond_resched() was a problem but now I don't know. The erasing
> has moved to the GC thread and been somewhat reworked. I don't know if
> it still needs yield(). Perhaps David can tell?

I think 'yield()' is rather a hack than a real solution.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [RFC] jffs2: use cond_resched() instead of yield()
  2010-09-02 10:59     ` Artem Bityutskiy
@ 2010-09-02 13:52       ` Joakim Tjernlund
  0 siblings, 0 replies; 6+ messages in thread
From: Joakim Tjernlund @ 2010-09-02 13:52 UTC (permalink / raw)
  To: dedekind1
  Cc: Artem Bityutskiy, linux-kernel, Wolfram Sang, linux-mtd,
	Ingo Molnar, dwmw2

Artem Bityutskiy <dedekind1@gmail.com> wrote on 2010/09/02 12:59:09:
>
> On Thu, 2010-09-02 at 09:01 +0200, Joakim Tjernlund wrote:
> > At the time cond_resched() was a problem but now I don't know. The erasing
> > has moved to the GC thread and been somewhat reworked. I don't know if
> > it still needs yield(). Perhaps David can tell?
>
> I think 'yield()' is rather a hack than a real solution.

Yes, the real fix is to move erasing to GC and that has been done now.
There is a good chance yield() can be removed without regression
but I am not sure nor do I have the time to test that.

 Jocke

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

* Re: [RFC] jffs2: use cond_resched() instead of yield()
  2010-09-01 16:03 [RFC] jffs2: use cond_resched() instead of yield() Wolfram Sang
  2010-09-01 18:35 ` Artem Bityutskiy
@ 2010-09-20 13:00 ` Artem Bityutskiy
  1 sibling, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2010-09-20 13:00 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Ingo Molnar, linux-mtd, linux-kernel

On Wed, 2010-09-01 at 18:03 +0200, Wolfram Sang wrote:
> yield() has different semantics meanwhile and even causes RT-kernels to
> BUG. Replace the only appearance left in jffs2.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: Ingo Molnar <mingo@elte.hu>

FYI, I've pushed this patch to my l2-mtd-2.6.git tree, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

end of thread, other threads:[~2010-09-20 13:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-01 16:03 [RFC] jffs2: use cond_resched() instead of yield() Wolfram Sang
2010-09-01 18:35 ` Artem Bityutskiy
2010-09-02  7:01   ` Joakim Tjernlund
2010-09-02 10:59     ` Artem Bityutskiy
2010-09-02 13:52       ` Joakim Tjernlund
2010-09-20 13:00 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).