Giter VIP home page Giter VIP logo

uncached-ram-lkm's Introduction

uncached ram lkm

map uncached memory in userspace experiment.

How to use

User process requests uncached memory by calling mmap() on module's character device (see kern.log for major number). type must be MAP_SHARED and size must be a multiple of page size. See test/test.c for example doing read benchmarks on cached / uncached memory.

Demo

# make
make -C /lib/modules/4.4.0-45-generic/build/ M=/root/src/uncached_ram_lkm modules
make[1]: Entering directory `/usr/src/linux-headers-4.4.0-45-generic'
  CC [M]  /root/src/uncached_ram_lkm/uncached_ram.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/src/uncached_ram_lkm/uncached_ram.mod.o
  LD [M]  /root/src/uncached_ram_lkm/uncached_ram.ko
make[1]: Leaving directory `/usr/src/linux-headers-4.4.0-45-generic'

# insmod uncached_ram.ko

# tail /var/log/kern.log
Jul 27 20:42:44 localhost kernel: [115315.205744] Uncached ram module loaded
Jul 27 20:42:44 localhost kernel: [115315.205764] Created char device, major: 249

# cd test

# mknod dev c 249 0

# make
gcc -Wall -ggdb3 -std=gnu99     test.c   -o test

# ./test
usage: ./test cached   uncached_mem_dev
       ./test uncached uncached_mem_dev

# ./test cached dev
cached mem test: 104856600 reads in 1.06s                                     (sum: 0)

# ./test uncached dev
mmap()'ing dev
uncached mem test: 104856600 reads in 10.73s                                     (sum: -138595026)

uncached-ram-lkm's People

Contributors

lemonsqueeze avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.