[Yaffs] YAFFS2 and kswapd dead lock problem

Lawson.Reed Reed.Lawson at IGT.com
Wed Nov 23 16:58:15 GMT 2005


Hi,

<Background>

We have been using YAFFS2 on 2 Samsung 512Meg parts (1 gig total)
on our project for about 6 months now (I'm on Linux 2.4.24-uc0 
(I know, I know... upgrade... well, to make a long story short
I can not.. because we are on a 5272 ColdFire and no one has ported
the USB or FEC drivers to 2.6 that I know of and I sure do not have
that much time on my hands....)) and it has been working GREAT!   

Except....

Once in a while (like maybe three times a week), access to the YAFFS2
file system blocks. The rest of the system continues to work, but 
somewhere someone is holding the grossLock and not letting go. 
Once this happens, if I just cd into my /nandfs directory, 
an 'ls' just hangs.

I originally thought it was an issue with the nand MTD code.
but I put debug LED flashes around every entry point and when
it hangs, none of those LEDs are on. 

I wrote a test app that spawns 10 pthreads that all hammer the YAFFS2
with fopen, fwrite, and fclose continuously with random nanosleep
times of up to 100 ms. It hangs after about 8 seconds of that.
I added a grossLock count to the /proc/yaffs file and sure enough
when this happens, it is way negative (like -4 or -7 or something)
and holding.

So, I modified yaffs_fs.c to print the pid of each call to 
the grossLock and grossUnlock routines. I see a flurry of pids
in the range of 30 to 40. That's my test app. But then I see
a pid of 4 and shortly after, the dead lock occurs....

pid 4 is kswapd.....

Well, being ignorant about kswapd, I googled it and could not find 
anything very useful on it. We are a small uClinux embedded system
and hence, we do not have a swap partition or an MMU.... So, what
good is kswapd??? 

I modified vmscan.c to simply not start the kswapd thread 
and my test app ran all night with no hangs....

</Background>

So, to my questions....

  Is anybody else seeing this?
  What is different about the way kswapd access YAFFS that causes the deadlock?
  Why is kswapd accessing the YAFFS file system anyway?
  How does it even know its there?
  What benefit is kswapd in my mmu-less embedded system?
  Is there any danger in just disabling kswapd?

I'll be searching for the answers to these questions and will post
answers if and when I find anything....

In the mean time, I'd sure appreciate 
any light you 'all can shed on this.

Thanks,
- Reed.

__________________________________
Reed Lawson
IGT Firmware Engineering
(775) 448-0755
 



More information about the yaffs mailing list