日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

I/O Performance HOWTO: Avoiding Bounce Buffers

發布時間:2025/3/20 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 I/O Performance HOWTO: Avoiding Bounce Buffers 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在 IA-32 系統中,物理內存最開始的1GB 被稱為“低端內存”,1GB 以上的部分稱為“高端內存”。先前的Linux 核心版本要求通往存儲設備的數據緩存必須放在物理RAM 的低端內存區域,即使是應用程序可以同時使用高端內存和低端內存也存在同樣狀況。這樣,來自低端內存區域數據緩存的I/O 請求可以直接進行內存存取操作。但是,當應用程序發出一個I/O 請求,其中包含位于高端內存的數據緩存時,核心將強制在低端內存中分配一個臨時數據緩存,并將位于高端內存的應用程序緩存數據復制到此處,這個數據緩存相當于一個跳轉的buffer。例如一些老設備只能訪問16M以下的內存,但DMA的目的地址卻在16M以上時,就需要在設備能訪問16M范圍內設置一個buffer作為跳轉。這種額外的數據拷貝被稱為“bounce buffering”,會明顯地降低I/O 密集的數據庫應用的性能,因為大量分配的bounce buffers 會占用許多內存,而且bouncebuffer 的復制會增加系統內存總線的負荷。

?

http://www.linuxdoc.org/HOWTO/IO-Perf-HOWTO/overview.html

3. Avoiding Bounce Buffers

This section provides information on applying and using the bounce buffer patch on the Linux 2.4 kernel. The bounce buffer patch, written by Jens Axboe, enables device drivers that support direct memory access (DMA) I/O to high-address physical memory to avoid bounce buffers.

This document provides a brief overview on memory and addressing in the Linux kernel, followed by information on why and how to make use of the bounce buffer patch.

3.1. Memory and Addressing in the Linux 2.4 Kernel

The Linux 2.4 kernel includes configuration options for specifying the amount of physical memory in the target computer. By default, the configuration is limited to the amount of memory that can be directly mapped into the kernel's virtual address space starting at PAGE_OFFSET. On i386 systems the default mapping scheme limits kernel-mode addressability to the first gigabyte (GB) of physical memory, also known as low memory. Conversely, high memory is normally the memory above 1 GB. High memory is not directly accessible or permanently mapped by the kernel. Support for high memory is an option that is enabled during?configuration of the Linux kernel.

3.2. The Problem with Bounce Buffers

When DMA I/O is performed to or from high memory, an area is allocated in low memory known as a bounce buffer. When data travels between a device and high memory, it is first copied through the bounce buffer.

Systems with a large amount of high memory and intense I/O activity can create a large number of bounce buffers that can cause memory shortage problems. In addition, the excessive number of bounce buffer data copies can lead to performance degradation.

Peripheral component interface (PCI) devices normally address up to 4 GB of physical memory. When a bounce buffer is used for high memory that is below 4 GB, time and memory are wasted because the peripheral has the ability to address that memory directly. Using the bounce buffer patch can decrease, and possibly eliminate, the use of bounce buffers.

3.3. Locating the Patch

The latest version of the bounce buffer patch is?block-highmem-all-18b.bz2, and it is available from Andrea Arcangeli's -aa series kernels athttp://kernel.org/pub/linux/kernel/people/andrea/kernels/v2.4/.

3.3.1. Configuring the Linux Kernel to Avoid Bounce Buffers

This section includes information on configuring the Linux kernel to avoid bounce buffers. The Linux Kernel-HOWTO at?http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html?explains the process of re-compiling the Linux kernel.

The following kernel configuration options are required to enable the bounce buffer patch:

Development Code?- To enable the configurator to display the?High I/O Support?option, select the?Code maturity level options?category and specify "y" to?Prompt for development and/or incomplete code/drivers.

High Memory Support?- To enable support for physical memory that is greater than 1 GB, select the?Processor type and features?category, and select a value from the?High Memory Support?option.

High Memory I/O Support?- To enable DMA I/O to physical addresses greater than 1 GB, select the?Processor type and features?category, and enter "y" to the?HIGHMEM I/O support?option. This configuration option is a new option introduced by the bounce buffer patch.

3.3.2. Enabled Device Drivers

The bounce buffer patch provides the kernel infrastructure, as well as the SCSI and IDE mid-level driver modifications to support DMA I/O to high memory. Updates for several device drivers to make use of the added support are also included with the patch.

If the bounce buffer patch is applied and you configure the kernel to support high memory I/O, many IDE configurations and the device drivers listed below perform DMA I/O without the use of bounce buffers:

aic7xxx_drv.o
aic7xxx_old.o
cciss.o
cpqarray.o
megaraid.o
qlogicfc.o
sym53c8xx.o

3.4. Modifying Your Device Driver to Avoid Bounce Buffers

If your device drivers are not listed above in the?Enabled Device Drivers?section, and the device is capable of high-memory DMA I/O, you can modify your device driver to make use of the bounce buffer patch as follows. More information on rebuilding a Linux device driver is available at?http://www.xml.com/ldd/chapter/book/index.html.

  • A.) For SCSI Adapter Drivers: set the?highmem_io?bit in the?Scsi_Host_Template?structure.

    B.) For IDE Adapter Drivers: set the?highmembit in the?ide_hwif_t?structure.

  • Call?pci_set_dma_mask(struct pci_dev *pdev, dma_addr_t mask)?to specify the address bits that the device can successfully use on DMA operations.

    If DMA I/O can be supported with the specified mask,?pci_set_dma_mask()?will set?pdev->dma_mask?and return 0. For SCSI or IDE, the mask value will also be passed by the mid-level drivers toblk_queue_bounce_limit(request_queue_t *q, u64 dma_addr)?so that bounce buffers are not created for memory directly addressable by the device. Drivers other than SCSI or IDE must callblk_queue_bounce_limit()?directly.

  • Use?pci_map_page(dev, page, offset, size, direction), instead of?pci_map_single(dev, address, size, direction)?to map a memory region so that it is accessible by the peripheral device.?pci_map_page()supports both high and low memory.

    The?address?parameter for?pci_map_single()?correlates to the?page?and?offset?parameters for?pci_map_page(). Use the?virt_to_page()?macro to convert an?address?to a?page?and?offset. The?virt_to_page()macro is defined by including pci.h. For example:

    void *address;
    struct page *page;
    unsigned long offset;
    page = virt_to_page(address);
    offset = (unsigned long) address & ~PAGE_MASK;

    Call?pci_unmap_page()?after the DMA I/O transfer is complete to remove the mapping established by?pci_map_page().

    pci_map_single()?is implemented using?virt_to_bus().?virt_to_bus()?handles low memory addresses only. Drivers supporting high memory should no longer call?virt_to_bus()?or?bus_to_virt().

  • If your driver calls?pci_map_sg()?to map a scatter-gather DMA operation, your driver should set the?page?and?offset?fields instead of the?address?field of the?scatterlist?structure. Refer to step 3 for converting an?address?to a?page?and?offset.

    If your driver is already using the PCI DMA API, continue to use?pci_map_page()?or?pci_map_sg()?as appropriate. However, do not use the?address?field of the?scatterlist?structure.

  • 轉載于:https://www.cnblogs.com/szhan/p/3388280.html

    總結

    以上是生活随笔為你收集整理的I/O Performance HOWTO: Avoiding Bounce Buffers的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 日本一区高清 | 麻豆免费在线观看视频 | 丁香七月婷婷 | 91精选 | 先锋影音中文字幕 | 亚洲一区二区自拍偷拍 | 久久精精品久久久久噜噜 | 嫩草网站 | 黄色综合网 | 国产精品一区二区黑人巨大 | 青青草www | 激情五月婷婷综合网 | 岛国在线视频 | 天天爽夜夜爽一区二区三区 | 夜夜骑av| 亚洲一页 | 男生看的污网站 | 日本一区二区不卡在线观看 | 神马久久久久久久 | 自拍偷拍欧美视频 | 无码精品a∨在线观看中文 福利片av | 91色在线播放| 欧洲亚洲一区 | 少妇在线播放 | 亚洲视频精品在线 | 欧美色欧美 | 亚洲国产日韩欧美一区二区三区 | 欧美鲁| 国产a精品| 特级黄色录像 | 日本一区中文 | 在线播放91 | 中文字幕 成人 | 91伊人网| 国产又黄又大又粗的视频 | 九九九久久久精品 | 狂野少女电影在线观看国语版免费 | 国产精品一区二区av | 中文字幕国产精品 | 在线观看少妇 | 男人的天堂在线播放 | 国产精品一区网站 | 波多野结衣一区二区三区中文字幕 | 成品人视频ww入口 | 亚洲欧美另类图片 | 久久九九99 | 2020狠狠干 | 日韩在线中文 | 激情视频91| 无遮挡边吃摸边吃奶边做 | 久久在线播放 | 波多野结衣一区二 | 欧美高清在线视频 | 天天躁日日躁bbbbb | 成人免费网站www网站高清 | 国产三级三级三级 | 午夜性激情 | 久久精品电影网 | 91啪国产 | 中文字幕观看av | 久久成人福利 | 农村少妇无套内谢粗又长 | 狼人伊人干 | 亚洲一二三四 | 国产最新视频 | 成人网免费| 伊人22综合 | 久久久国产亚洲 | 黄色a级片网站 | 日本午夜精品 | 日韩免费成人av | 女人下面喷水视频 | 精品国产视频一区二区三区 | 国产精品熟女久久久久久 | 91人人看| 全国男人的天堂网 | 成年性生交大片免费看 | 久久久免费高清视频 | 成人黄色短视频在线观看 | 欧美天天性影院 | 欧美性爱精品一区 | 久久91亚洲 | 无码人妻一区二区三区免费n鬼沢 | 免费伊人网 | 亚洲成年人专区 | 亚洲激情二区 | 婷婷99 | 小镇姑娘高清播放视频 | hs网站在线观看 | 51精品| 国产wwwwww| 蜜芽在线视频 | 日本在线免费视频 | 成人深夜电影 | 在线免费观看a视频 | 含羞草一区二区三区 | 国产激情精品 | 视频在线一区 | 播播激情网|