Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 252987 - New ebuild: compcache
Summary: New ebuild: compcache
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement with 4 votes (vote)
Assignee: Default Assignee for New Packages
URL: http://forum.linode.com/viewtopic.php...
Whiteboard: sunrise suggested
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2008-12-29 13:12 UTC by Erik Hahn
Modified: 2016-12-13 21:15 UTC (History)
24 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/var/repos/local/sys-kernel/compcache/compcache-0.5_pre1.ebuild (compcache-0.5_pre1.ebuild,972 bytes, text/plain)
2008-12-29 13:12 UTC, Erik Hahn
Details
/var/repos/local/sys-kernel/compcache/files/compcache-confd (compcache-confd,170 bytes, text/plain)
2008-12-29 13:13 UTC, Erik Hahn
Details
/var/repos/local/sys-kernel/compcache/files/compcache-initd (compcache-initd,508 bytes, text/plain)
2008-12-29 13:13 UTC, Erik Hahn
Details
Patch for above build to fix output directory (compcache.KBUILD_OUTPUT.patch,587 bytes, patch)
2008-12-30 21:17 UTC, Martin Väth
Details | Diff
More reliable compcache-initd (compcache-initd,520 bytes, text/plain)
2009-01-04 10:45 UTC, Martin Väth
Details
updated ebuild for compcache 0.5.3 (compcache-0.5.3.ebuild,1.17 KB, text/plain)
2009-05-28 00:20 UTC, Craig Andrews
Details
sys-block/compcache-0.5.3.ebuild (compcache-0.5.3.ebuild,994 bytes, text/plain)
2009-08-04 14:56 UTC, MATSUU Takuto (RETIRED)
Details
sys-block/compcache-0.6_pre2.ebuild (compcache-0.6_pre2.ebuild,1.11 KB, text/plain)
2009-08-04 14:57 UTC, MATSUU Takuto (RETIRED)
Details
sys-block/compcache-0.6.ebuild (compcache-0.6.ebuild,1021 bytes, text/plain)
2009-12-21 00:43 UTC, Victor Tseng
Details
sys-block/compcache/files/init.d-compcache (init.d-compcache,1.20 KB, text/plain)
2009-12-21 00:44 UTC, Victor Tseng
Details
sys-block/compcache/files/conf.d-compcache (conf.d-compcache,425 bytes, text/plain)
2009-12-21 00:45 UTC, Victor Tseng
Details
sys-block/compcache-0.6.2.ebuild (compcache-0.6.2.ebuild,1.52 KB, text/plain)
2010-02-25 13:49 UTC, MATSUU Takuto (RETIRED)
Details
add use flag for the swap_free_notify patch (compcache-0.6.2-r1.ebuild,1.68 KB, text/plain)
2010-07-21 20:45 UTC, Assaf Berg
Details
patch to the compache sources to enable the optional swa_free_notify feature (compcache-0.6.2-free_notify.patch,481 bytes, patch)
2010-07-21 20:46 UTC, Assaf Berg
Details | Diff
compcache-0.7-r9999.ebuild (compcache-0.7-r9999.ebuild,1.43 KB, text/plain)
2011-01-26 19:22 UTC, Luke McKinlay
Details
new initd-compcache (init.d-compcache,1.48 KB, text/plain)
2011-01-26 19:23 UTC, Luke McKinlay
Details
new conf.d-compcache (conf.d-compcache,606 bytes, text/plain)
2011-01-26 19:24 UTC, Luke McKinlay
Details
new init.d-compcache (init.d-compcache,1.55 KB, text/plain)
2011-01-26 20:01 UTC, Luke McKinlay
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Hahn 2008-12-29 13:12:03 UTC
This is an ebuild for compcache, see http://code.google.com/p/compcache/.
Comment 1 Erik Hahn 2008-12-29 13:12:48 UTC
Created attachment 176741 [details]
/var/repos/local/sys-kernel/compcache/compcache-0.5_pre1.ebuild

Ebuild for compcache 0.5pre
Comment 2 Erik Hahn 2008-12-29 13:13:09 UTC
Created attachment 176742 [details]
/var/repos/local/sys-kernel/compcache/files/compcache-confd

conf.d file
Comment 3 Erik Hahn 2008-12-29 13:13:20 UTC
Created attachment 176744 [details]
/var/repos/local/sys-kernel/compcache/files/compcache-initd

Init script
Comment 4 Jeremy Olexa (darkside) (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2008-12-30 17:05:20 UTC
(this is an automated message based on filtering criteria that matched this bug)

Hello, The Gentoo Team would like to firstly thank you for your ebuild submission. We also apologize for not being able to accommodate you in a timely manor. There are simply too many new packages.

Allow me to use this opportunity to introduce you to Gentoo Sunrise. The sunrise overlay[1] is a overlay for Gentoo which we allow trusted users to commit to and all users can have ebuilds reviewed by Gentoo devs for entry into the overlay. 
So, the sunrise team is suggesting that you look into this and submit your ebuild to the overlay where even *you* can commit to. =)

Because this is a mass message, we are also asking you to be patient with us. We anticipate a large number of requests in a short time. 

Thanks,
On behalf of the Gentoo Sunrise Team,
Jeremy.

[1]: http://www.gentoo.org/proj/en/sunrise/
[2]: http://overlays.gentoo.org/proj/sunrise/wiki/SunriseFaq
Comment 5 Martin Väth 2008-12-30 21:17:09 UTC
Created attachment 176912 [details, diff]
Patch for above build to fix output directory

The Makefiles from the tarball have hardcoded the kernel output directory.
This breaks for users employing KBUILD_OUTPUT to compile the kernel in a
different directory. So the Makefiles need to be patched with KV_OUT_DIR as
the output directory. The attached patch to the ebuild does this.

BTW: Perhaps sys-fs is a better category than sys-kernel?
Comment 6 Erik Hahn 2008-12-30 22:11:37 UTC
(In reply to comment #5)
> BTW: Perhaps sys-fs is a better category than sys-kernel?
sys-kernel somehow doesn't fit but sys-fs is IMHO even worse (unless you consider swap space a file system. Maybe sys-block?
Comment 7 Martin Väth 2009-01-04 10:45:09 UTC
Created attachment 177319 [details]
More reliable compcache-initd

On my machine 1 second is usually not enough until /dev/ramzswap0 appears.
So I patched the compcache-initd script to wait until it is up (with some
timeout to avoid an endless loop in case of problems).
Since the patch is longer than the script, I attach the rewritten script.
Comment 8 Craig Andrews gentoo-dev 2009-05-27 20:36:15 UTC
Instead of using an init script, perhaps using a udev rule would be more elegant? That way, there's no sleeping/waiting, and the script is incredibly simple:

KERNEL=="ramzswap0", ACTION=="add", \\
  RUN+="/sbin/swapon -p 100 /dev/ramzswap0 2>/dev/null"

See https://wiki.ubuntu.com/Compcache for some more ideas
Comment 9 Craig Andrews gentoo-dev 2009-05-28 00:20:02 UTC
Created attachment 192654 [details]
updated ebuild for compcache 0.5.3

The module name changed to ramzswap. This ebuild reflects that change.
Comment 10 MATSUU Takuto (RETIRED) gentoo-dev 2009-08-04 14:56:26 UTC
Created attachment 200151 [details]
sys-block/compcache-0.5.3.ebuild

clean up.

I think that it should be in sys-block or sys-apps category.
Comment 11 MATSUU Takuto (RETIRED) gentoo-dev 2009-08-04 14:57:02 UTC
Created attachment 200153 [details]
sys-block/compcache-0.6_pre2.ebuild
Comment 12 Dennis Nezic 2009-11-09 19:32:17 UTC
It doesn't compile with my linux kernel 2.6.32-rc6,
   /ramzswap.c:1284: error: implicit declaration of function ‘blk_queue_hardsect_size’

Renaming the ebuild to simply compcache-0.6.ebuild (which I think is newer) also doesn't work with:
   /ramzswap.c:926: error: implicit declaration of function ‘bio_discard’
   /ramzswap.c:1027: error: implicit declaration of function ‘blk_queue_set_discard’
Comment 13 Dennis Nezic 2009-11-09 20:12:09 UTC
The latest mercurial source code upstream works with the new kernels, so I guess we should just wait till they make a point release of it.

(0.6.1 will no longer create an xvmalloc module, so the ebuild needs to be adjusted for that ... and the compiled rzscontrol binary should be used in the init.d scripts to create the space.)
Comment 14 Victor Tseng 2009-12-21 00:43:23 UTC
Created attachment 213623 [details]
sys-block/compcache-0.6.ebuild

version bump, linux 2.6.32+ has ramzswap module inside staging drivers section, so this ebuild doesn't compile/install the kernel module.
Comment 15 Victor Tseng 2009-12-21 00:44:27 UTC
Created attachment 213624 [details]
sys-block/compcache/files/init.d-compcache

init.d/compcache runlevel script
Comment 16 Victor Tseng 2009-12-21 00:45:37 UTC
Created attachment 213627 [details]
sys-block/compcache/files/conf.d-compcache

conf.d/compcache settings file.
Comment 17 Victor Tseng 2009-12-21 00:48:16 UTC
forgot th mention, my compcache-0.6.ebuild is confirmed to cross-compile fine - ie. you can do a `emerge-armv7a-softfloat-linux-gnueabi compcache` for beagleboard, etc.
Comment 18 Paul Tobias 2010-02-25 13:06:20 UTC
I think bug #299664 is a duplicate of this bug.
Comment 19 MATSUU Takuto (RETIRED) gentoo-dev 2010-02-25 13:49:41 UTC
Created attachment 221141 [details]
sys-block/compcache-0.6.2.ebuild
Comment 20 Ofer Wald 2010-03-03 06:37:29 UTC
Building the module is still required as per compcache documentation wrt kernel 2.6.33, also - I wonder if there's a way to check if the patch provided was applied to the kernel to compile accordingly
Comment 21 MATSUU Takuto (RETIRED) gentoo-dev 2010-04-20 09:54:24 UTC
*** Bug 299664 has been marked as a duplicate of this bug. ***
Comment 22 Sven Eden 2010-04-28 12:12:17 UTC
(In reply to comment #20)
> Building the module is still required as per compcache documentation wrt kernel
> 2.6.33, also - I wonder if there's a way to check if the patch provided was
> applied to the kernel to compile accordingly
> 

As for gentoo-sources-2.6.33-r1, no patch seems to be required. The ramzswap.ko module builds fine, and the rzscontrol from this ebuild works like a charm.

One thing, though: Could an option be added to /etc/conf.d/compcache to set a priority for the ramz swap devices? (swapon -p option)
Comment 23 Zac Medico gentoo-dev 2010-05-15 07:27:08 UTC
(In reply to comment #22)
> As for gentoo-sources-2.6.33-r1, no patch seems to be required. The ramzswap.ko
> module builds fine, and the rzscontrol from this ebuild works like a charm.

Well, the ramzswap module isn't the latest code. It's missing the disksize_kb, memlimit_kb, and backing_swap module parameters. Maybe rzscontrol can control those things, but that's different from being able to specify them as module parameter. Looking at current v2.6.34-rc7 sources, it seems that the new module parameters are not there yet.

Anyway, hopefully the in-kernel ramzswap module will catch up by 2.6.35 or so. When that happens we'll probably want a separate compcache-tools ebuild as in bug #299664.
Comment 24 Richard 2010-05-24 11:22:10 UTC
It is posssible to do a version bump by copying this ebuild's directory into a local overlay and modifying the file names. The compcache-0.6.ebuild in sunrise is better written than the compcache-0.6.2.ebuild here, so doing that is probably a good idea.
Comment 25 Assaf Berg 2010-07-17 13:30:33 UTC
Hi,

I tried compcache-0.6.2.ebuild from comment #19, and it seems to work fine.

There is an issue though. If ramzswap is statically compiled in, the ebuild can't control the number of devices, so it should check that the /dev/ramzswapN device node exists (by default the is only one).
Comment 26 Assaf Berg 2010-07-21 20:45:21 UTC
Created attachment 239721 [details]
add use flag for the swap_free_notify patch

I've added a use flag that enables the optional (but recommended) swap_free_notify functionality. It also requires patching and recompiling the kernel (so I also added the patch to the dodoc)

BTW, I think it is also important to add SWAPON_OPTS in the conf.d for setting the priority. It is important to set the same priority for all the devices when using multiple cpu core, but without passing -p to swapon, they will be created with different priorities.
Comment 27 Assaf Berg 2010-07-21 20:46:51 UTC
Created attachment 239723 [details, diff]
patch to the compache sources to enable the optional swa_free_notify feature

filesdir patch used by the -r1 ebuild posted in the previous comment
Comment 28 Ziga Boehm 2010-08-12 07:26:38 UTC
compcache 0.6.2 doesn't work with kernel 2.6.35 anymore - for some additional information see http://code.google.com/p/compcache/issues/detail?id=68
Comment 29 Luke McKinlay 2011-01-26 19:22:42 UTC
Created attachment 260804 [details]
compcache-0.7-r9999.ebuild

This is a new ebuild to support trunk from mercurial
This is needed now because it no longer uses any userspace helpers and we are just dealing with a kernel module. It also does more than swap! It can do your tmpfs mount too with a filesystem on top of it (e.g ext4)

It requires the new init.d / conf.d attachments too and free_notify patch to be renamed.

The initrd script still supports multiple swap disks and I added a little more sanity checks for the users who use monolithic kernels that have been patched.

The userspace tools are gone, but if you one you need a different ebuild;
http://bugs.gentoo.org/attachment.cgi?id=253479&action=view
Comment 30 Luke McKinlay 2011-01-26 19:23:58 UTC
Created attachment 260806 [details]
new initd-compcache

place in sys-block/compcache/files dir in your local portage overlay
Comment 31 Luke McKinlay 2011-01-26 19:24:40 UTC
Created attachment 260808 [details]
new conf.d-compcache

place in sys-block/compcache/files dir in your local portage overlay
Comment 32 Luke McKinlay 2011-01-26 20:01:02 UTC
Created attachment 260809 [details]
new init.d-compcache

fixes a missing $ in the script. hot of the press. put it in your files dir.
Comment 33 Zac Medico gentoo-dev 2011-02-05 22:13:07 UTC
(In reply to comment #29)
> Created an attachment (id=260804) [details]
> compcache-0.7-r9999.ebuild

Thanks, it builds/installs fine for me.

I've noticed that the mainline linux-2.6.37 sources include swap_slot_free_notify support, so maybe the swap_free_notify USE flag isn't really needed, or could be enabled by default.

Also, my kernel has CONFIG_ZRAM=m (drivers/staging/zram in mainline kernel), and the ebuild did not produce any warning about the redundant module. So, now I've got two zram modules:

   /lib/modules/2.6.37/compcache/zram.ko
   /lib/modules/2.6.37/kernel/drivers/staging/zram/zram.ko
Comment 34 Victor Tseng 2011-02-07 02:17:31 UTC
(In reply to comment #33)
> (In reply to comment #29)
> > Created an attachment (id=260804) [details] [details]
> > compcache-0.7-r9999.ebuild
> 
> Thanks, it builds/installs fine for me.
> 
> I've noticed that the mainline linux-2.6.37 sources include
> swap_slot_free_notify support, so maybe the swap_free_notify USE flag isn't
> really needed, or could be enabled by default.
> 
> Also, my kernel has CONFIG_ZRAM=m (drivers/staging/zram in mainline kernel),
> and the ebuild did not produce any warning about the redundant module. So, now
> I've got two zram modules:
> 
>    /lib/modules/2.6.37/compcache/zram.ko
>    /lib/modules/2.6.37/kernel/drivers/staging/zram/zram.ko
> 
the CONFIG_ZRAM=m (drivers/staging/zram) inside the kernel (2.6.35/2.6.36/2.6.37/9999) is some mysterious version of compcache and require some userspace tools i don't know where to find (or which hg version i should checkout from the repository). it's not 0.6.* nor 0.7.* (9999).

2.6.35 kernels doesn't have swap_notify_free(), the use flag is probably for that, i guess.
Comment 35 Victor Tseng 2011-02-07 02:22:37 UTC
the control interface has changed a lot (from modprobe module params to ioctls to sysfs interface).
and all of them are really different.

module params take `modprobe compcache numdevices=8 disksize_kb=262144` like format of syntax
ioctls requres some userspace tools to set the device size (but still take module params to set number of devices)
the sysfs interface (latest) can just `echo 268435456 > /sys/block/zram0/disksize`, but still requres the numdevices module param.

Comment 36 Zac Medico gentoo-dev 2011-02-07 09:54:54 UTC
(In reply to comment #34)
> (2.6.35/2.6.36/2.6.37/9999) is some mysterious version of compcache and require
> some userspace tools i don't know where to find (or which hg version i should
> checkout from the repository). it's not 0.6.* nor 0.7.* (9999).

The zramconfig utility works with 2.6.36, and there's an ebuild for it attached in bug 299664, comment #5 (note EHG_REVISION=146).

The new sysfs interface is merged in 2.6.37, and documented in zram.txt:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/staging/zram/zram.txt;hb=HEAD
Comment 37 Assaf Berg 2011-02-22 14:26:11 UTC
I'm using the kernel module from the official tree (staging) in 2.6.37 with the pure sysfs interface and it works fine.
I've modified the conf.d/init.d to use sysfs and no need for the zramconfig binary anymore (if anyone is interested it's here: https://github.com/asssaf/portage/tree/master/sys-block/zram ).

Is there any advantage to using the hg source over the staging driver?
Comment 38 Leho Kraav (:macmaN @lkraav) 2011-04-16 23:16:14 UTC
hmmm, so trying to make a 10MB zramdisk with just conf.d/modules and fstab fails right now because there is no way to specify disk size with modprobe? any other mechanism to react on modprobe zram with echo yaddayadda before we process fstab?
Comment 39 Jaak Ristioja 2012-02-22 07:48:32 UTC
Bump.
Comment 40 Zac Medico gentoo-dev 2016-12-13 21:15:26 UTC
I guess we can consider this superseded by zram-init:

https://packages.gentoo.org/packages/sys-block/zram-init