Linux kernel Cache

Source: Internet
Author: User

Write drivers always run into things that are related to the cache.

Log the interfaces used:

The memory address used in the drive is usually the kernel address, when the user calls the driver interface, sometimes the address of the application is assigned to the driver, when the user Kmalloc get the kernel address.

Then use MMAP to obtain the mapped user address, at this time users use the user address, will use the cache, in order to ensure the real-time data, sometimes the driver should be some operation of the cache

1. __sync_cache_range_r ((void*) start, size);

When the user reads the buffer data, it is read from the cache, and this interface invalidates the cache of the kernel address, which is used to read the data directly from the actual physical address.

Thus guaranteeing the correctness of the data

2. __sync_cache_range_w ((void*) start, size);

When the user writes the data, it is written to the cache, the driver in order to ensure that the data is written to the actual physical address, with this interface, the cache failure data to write to the physical address

Linux kernel Cache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.