{"id":15418784,"url":"https://github.com/mfrw/compcache","last_synced_at":"2026-01-07T10:07:22.605Z","repository":{"id":77647008,"uuid":"33181415","full_name":"mfrw/compcache","owner":"mfrw","description":"Automatically exported from code.google.com/p/compcache","archived":false,"fork":false,"pushed_at":"2015-03-31T11:23:46.000Z","size":1016,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T05:13:22.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mfrw.png","metadata":{"files":{"readme":"README","changelog":"Changelog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-31T11:21:09.000Z","updated_at":"2015-03-31T11:21:48.000Z","dependencies_parsed_at":"2023-02-27T14:30:23.922Z","dependency_job_id":null,"html_url":"https://github.com/mfrw/compcache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfrw%2Fcompcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfrw%2Fcompcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfrw%2Fcompcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfrw%2Fcompcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mfrw","download_url":"https://codeload.github.com/mfrw/compcache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245966928,"owners_count":20701759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T17:22:33.958Z","updated_at":"2026-01-07T10:07:17.573Z","avatar_url":"https://github.com/mfrw.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"zram: Compressed RAM based block devices\n----------------------------------------\n\nProject home: http://compcache.googlecode.com/\n\n* Introduction\n\nThe zram module creates RAM based block devices named /dev/zram\u003cid\u003e\n(\u003cid\u003e = 0, 1, ...). Pages written to these disks are compressed and stored\nin memory itself. These disks allow very fast I/O and compression provides\ngood amounts of memory savings. Some of the usecases include /tmp storage,\nuse as swap disks, various caches under /var and maybe many more :)\n\nStatistics for individual zram devices are exported through sysfs nodes at\n/sys/block/zram\u003cid\u003e/\n\nHelp page:\n  http://compcache.googlecode.com/CompilingAndUsingNew\n\n* Compiling\n  - 'make':\tThis will compile zram module against your kernel\n  - Optional (HIGHLY RECOMMENDED): ** Only for kernels older than 2.6.35 **\n\t- Apply the patch found in compcache/patches/ directory and just\n\t  compile the kernel as usual. This patch enables 'swap free notify'\n\t  feature which allows the kernel to send callback to zram as soon\n\t  as a swap slot becomes free. So, we can immediately free memory\n\t  allocated for the corresponding page, eliminating any stale data\n\t  in (compressed) memory. Currently, patches are available for\n\t  2.6.29 and 2.6.33 kernels but it should apply to 'nearby' kernel\n\t  versions too.  \n\t- Uncomment '#define CONFIG_SWAP_FREE_NOTIFY' in compcache/compat.h\n\t  before compiling compcache against this patched kernel. Otherwise,\n          this swap notify callback will not be used.\n\t- Note that this patch is applicable only when zram devices are\n\t  intended to be used as swap disks. They do not help when used\n\t  for other purposes (see examples below).\n\nFollowing binaries are created:\n  - zram.ko (kernel driver)\n\n* Usage\n\nFollowing shows a typical sequence of steps for using zram.\n\n1) Load Module:\n\tmodprobe zram num_devices=4\n\tThis creates 4 devices: /dev/zram{0,1,2,3}\n\t(num_devices parameter is optional. Default: 1)\n\n2) Set Disksize:\n\tSet disk size by writing the value to sysfs node 'disksize'\n\t(in bytes). If disksize is not given, default value of 25%\n\tof RAM is used.\n\n\t# Set disksize of 50MB for /dev/zram0\n\techo $((50*1024*1024)) \u003e /sys/block/zram0/disksize\n\n\tNOTE: disksize cannot be changed if the disk contains any\n\tdata. So, for such a disk, you need to issue 'reset' (see below)\n\tbefore you can change its disksize.\n\n3) Activate:\n\tmkswap /dev/zram0\n\tswapon /dev/zram0\n\n\tmkfs.ext4 /dev/zram1\n\tmount /dev/zram1 /tmp\n\n4) Statistics:\n\tPer-device statistics are exported as various nodes under\n\t/sys/block/zram\u003cid\u003e/\n\t\tdisksize\n\t\tnum_reads\n\t\tnum_writes\n\t\tinvalid_io\n\t\tnotify_free\n\t\tdiscard\n\t\tzero_pages\n\t\torig_data_size\n\t\tcompr_data_size\n\t\tmem_used_total\n\n\tA helper script is included (sub-projects/scripts/zram_stats)\n\twhich shows these stats for devices containing any data. It also\n\tshows (derived) values for average compression ratio and memory\n\toverhead.\n\n5) Deactivate:\n\tswapoff /dev/zram0\n\tumount /dev/zram1\n\n6) Reset:\n\tWrite any positive value to 'reset' sysfs node\n\techo 1 \u003e /sys/block/zram0/reset\n\techo 1 \u003e /sys/block/zram1/reset\n\n\t(This frees all the memory allocated for the given device).\n\n\nPlease report any problems at:\n - Mailing list: linux-mm-cc at laptop dot org\n - Issue tracker: http://code.google.com/p/compcache/issues/list\n\nNitin Gupta\nngupta@vflare.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfrw%2Fcompcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfrw%2Fcompcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfrw%2Fcompcache/lists"}