JFFS2 alloc_sem contention
I have a 45MB JFFS2 partition that is usually about 70% full. My application developers are sad that sometimes a small write can take up to 30 seconds.
I have increased the priority of the GC thread so that the chances of a write having to do garbage collection are small.
I have increased the value of resv_blocks_write and resv_blocks_gctrigger so that when GC does happen, it has enough free blocks to work with, maximizing efficiency.
I have run KFT to discover exactly where the block is happening. Here is the story:
1. garbage collection runs 2. a big file gets written, eg "cp /path/to/mybigfile /path/to/jffs2" 3. the big file cp enters jffs2_reserve_space and grabs the alloc_sem 4. a small file gets written, eg "cp /path/to/smallfile /path/to/jffs2" 5. the small file cp enters jffs2_reserve_space and blocks on alloc_sem 6. the big file takes up to 30s to finish writing, then releases alloc_sem 7. the small file cp completes with a huge latency
I know the pid of the process that does the small writes. I would like to give it priority over the big writes. I would be satisfied if I could have the big write return from sys_write having only written a part of the buffer.
I have tried to use ioprio to increase the small writer's priority, but apparently JFFS2 does not check ioprio.
Any advice?
Thanks,
Dave