[linux-mm-cc] Compcache as Ramdisk

Vijayendra Suman vijayendra.suman at gmail.com
Mon Jul 20 09:17:13 EDT 2009


Hi All,

I finally got the solution to the hang problem.
To make it run as ramdisk,

In function valid_swap_request function I have removed the check for 1 page,
i enabled multiple pages,
The problem here was some pages are being coalesce so pages which are on
common bondary will be made to one bio request, in the present compcache
code, as it is made for swap subsystem so it only works for PAGE_SIZE,
I have added this check as

static inline int valid_swap_request(struct bio *bio)
{
 if (unlikely(
   (bio->bi_sector >= (compcache.disksize >> SECTOR_SHIFT)) ||
   (bio->bi_sector & (SECTORS_PER_PAGE - 1)) ||
   (bio->bi_size & (PAGE_SIZE - 1))))
   {
   printk("Invalid Request\n");
   return 0;
   }
 return 1;
}

In the function compcache_make_request function i added

 bio_for_each_segment( bv, bio, i )
{
 page = bv->bv_page;
 page_no = ((bio->bi_sector >> SECTORS_PER_PAGE_SHIFT) + i);
{
... /* Switch Loop */
}

To complete the page copy we do

  set_bit(BIO_UPTODATE, &bio->bi_flags);
  BIO_ENDIO(bio, 0);
  return 0;
I have changed the compat.h

#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
#define BIO_IO_ERROR(bio) bio_io_error(bio, PAGE_SIZE)
#define BIO_ENDIO(bio, error) bio_endio(bio, bio->bi_vcnt*PAGE_SIZE, error)
#else
#define BIO_IO_ERROR(bio) bio_io_error(bio)
#define BIO_ENDIO(bio, error) bio_endio(bio, error)
#endif

Doing this works fine for my x86  system.

But still there is one more problem it still does not work for ext2 file
system. I will get the solution and let you know about it.

Sincere Regards
Vijayendra Suman



On Fri, Jul 10, 2009 at 1:22 PM, Vijayendra Suman <
vijayendra.suman at gmail.com> wrote:

> Hi
>
> I am sorry for the typo
>
>> Bonnie -d 32 /mnt -s 50 & sync # Bonnie process hangs
>
>
> Bonnie -d /mnt -s 50 & sync # Bonnie process hangs
>
> Sincere Regards
> Vijayendra Suman
>
> On Fri, Jul 10, 2009 at 12:08 PM, Vijayendra Suman <
> vijayendra.suman at gmail.com> wrote:
>
>> Hi John, Nitin,
>>
>> I think i have not explained well about the method for the hang.
>>
>> 1) insmod xvmalloc.ko; # I use 0.5.3 version
>> 2) insmod lzo-faster.ko; # I use a modified form of compressor, this helps
>> me to boot my application faster.
>> We can try this same by inserting compressor and decompressor modules
>> which is given in the compcache release.
>> 3) insmod compcache.ko;
>>
>>    -  State 1
>>
>> mkfs.ext3 /dev/ramzswap0
>> mount -t ext3 /dev/ramzswap0 /mnt;
>> Bonnie -d 32 /mnt -s 50 & sync # works well no problem
>>
>>    - State 2
>>
>> mkfs.vfat /dev/ramzswap0
>> mount /dev/ramzswap0 /mnt;
>> Bonnie -d 32 /mnt -s 50 & sync # Bonnie process hangs
>>
>> If a application hangs it is a problem; which needs to be checked why this
>> happens.
>>
>>    - State 3 # Boot Kernel 2.6.30;
>>
>> mkfs.vfat /dev/ramzswap0
>> mount /dev/ramzswap0 /mnt;
>> Bonnie -d 32 /mnt -s 50 & sync # works well no problem
>>
>> I will try to find the issue and let you know
>>
>> Sincere Regards
>> Vijayendra Suman
>>
>>
>>
>>
>> On Fri, Jul 10, 2009 at 11:46 AM, Nitin Gupta <nitingupta910 at gmail.com>wrote:
>>
>>> Hi Vijayendra,
>>>
>>> On 07/10/2009 10:57 AM, Vijayendra Suman wrote:
>>>
>>>>
>>>> My main motive is not to run the compcache block node as a swap
>>>> partition. I would like to use this partition for shared memory. My
>>>> application has to do lot of IPC's but i do not have much memory on board so
>>>> i have decided to use compcache block device node as a generalized block
>>>> device.
>>>>
>>>> How about this:
>>>  - Create a small tmpfs partition, say 64MB and create filesystem over
>>> this.
>>>  - Create ramzswap device (probably with a backing_swap) with memlimit of
>>> say, 1GB.
>>>
>>> This extra level of indirection using tmpfs effectively gives the same
>>> effect as a 'generic ramzswap device'.
>>> I think this is what John suggested.
>>>
>>> Also I have checked formatting this node with some block as ext3, this
>>>> works perfectly well.
>>>> With ext2 it is having some issue i will look in to it, But with fat 16,
>>>> 32 I see a hang in the system which is a result of the analysis i have done.
>>>> I will let you know f i find some thing.
>>>>
>>>>    1) swapon /dev/ramzswap
>>>>    2) mount -t tmpfs -o size=1G,nr_inodes=10k,mode=0700 tmpfs /space
>>>>
>>>>
>>>> I do not want it as swap partition
>>>>
>>>>
>>> I cannot think of any other method than tmpfs+ramzswap for your case.
>>>
>>> Nitin
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/linux-mm-cc/attachments/20090720/e7947c9c/attachment.htm 


More information about the linux-mm-cc mailing list