Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[RFC] jffs2: use cond_resched() instead of yield()

49 views
Skip to first unread message

Wolfram Sang

unread,
Sep 1, 2010, 12:04:18 PM9/1/10
to linux-...@vger.kernel.org, linu...@lists.infradead.org, Wolfram Sang, Artem Bityutskiy, Ingo Molnar
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.s...@pengutronix.de>
Cc: Artem Bityutskiy <Artem.Bi...@nokia.com>
Cc: Ingo Molnar <mi...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Artem Bityutskiy

unread,
Sep 1, 2010, 2:36:16 PM9/1/10
to Wolfram Sang, linux-...@vger.kernel.org, linu...@lists.infradead.org, Artem Bityutskiy, Ingo Molnar, dw...@infradead.org
This 'yield()' was introduced by dwmw2, so he may have strong feelings
about it. CCed.

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

Joakim Tjernlund

unread,
Sep 2, 2010, 3:13:31 AM9/2/10
to dede...@gmail.com, Artem Bityutskiy, dw...@infradead.org, linux-...@vger.kernel.org, linu...@lists.infradead.org, Ingo Molnar, Wolfram Sang
>
> 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.T...@transmode.se>
Signed-off-by: David Woodhouse <dw...@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

> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/N▀╖╡ФЛr╦⌡yЗХ ьb╡X╛╤г╖vь^√)ч╨{.nг+┴╥╔┼{╠▒ЙГzX╖╤ ⌡║э╗}╘·╡ф═zз&j:+v┴╗╬ ╚▒ЙГzZ+─й+zfё╒╥h ┬╖~├╜├шiЪШЮz╧ ╝w╔╒╦?≥╗Х╜з&╒)ъ╒ f■Ы^jг╚y╖m┘А@A╚a╤з Ъ 0╤Лh╝ Е▓i

Artem Bityutskiy

unread,
Sep 2, 2010, 6:59:20 AM9/2/10
to Joakim Tjernlund, Artem Bityutskiy, dw...@infradead.org, linux-...@vger.kernel.org, linu...@lists.infradead.org, Ingo Molnar, Wolfram Sang
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 (Битюцкий Артём)

--

Joakim Tjernlund

unread,
Sep 2, 2010, 9:57:59 AM9/2/10
to dede...@gmail.com, Artem Bityutskiy, dw...@infradead.org, linux-...@vger.kernel.org, linu...@lists.infradead.org, Ingo Molnar, Wolfram Sang
Artem Bityutskiy <dede...@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

Artem Bityutskiy

unread,
Sep 20, 2010, 9:03:14 AM9/20/10
to Wolfram Sang, linux-...@vger.kernel.org, linu...@lists.infradead.org, Ingo Molnar
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.s...@pengutronix.de>
> Cc: Artem Bityutskiy <Artem.Bi...@nokia.com>
> Cc: Ingo Molnar <mi...@elte.hu>

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

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

0 new messages