当前位置: 首页 > news >正文

温州建设工程网站/seo关键词排名优化销售

温州建设工程网站,seo关键词排名优化销售,我自己做个网站怎么做,通过网页制作能赚钱吗ION 内存管理 标签: bufferstructallocationconstraintsuserorthogonal2012-05-10 16:21 8085人阅读 评论(2) 收藏 举报分类:android 学习(18) 版权声明:本文为博主原创文章,未经博主允许不得转载。 目录(?…

ION 内存管理

标签: bufferstructallocationconstraintsuserorthogonal
 8085人阅读 评论(2) 收藏 举报
 分类:
 

目录(?)[+]

what is ION?

  • ION  内存管理从android4.0开始被引入
  • ION模块是可扩展的(API都是统一的),支持各种形式的内存分配方式,可以表述不同的硬件资源和他们的一些限制
  • ION 支持连续与不连续内存的分配
  • ION Kernel and User space processes提供了相应的APIs

 当前支持的memory type

  • ION_HEAP_TYPE_CARVEOUT - memory (PMEM style) for larger physically contiguous allocations
  • ION_HEAP_TYPE_SYSTEM_CONTIG - physically contiguous for small physical allocations
  • ION_HEAP_TYPE_SYSTEM - virtually contiguous but physically discontiguous memory
  • ION_HEAP_TYPE_IOMMU - memory region allocated through IOMMU API.

 

ION heap 的大小根据每个设备自身的内存情况而定,但是都要实现下面的回调:

   struct ion_heap_ops {
        int (*allocate) (struct ion_heap *heap,
                        struct ion_buffer *buffer, unsigned long len,
                        unsigned long align, unsigned long flags);
        void (*free) (struct ion_buffer *buffer);
        int (*phys) (struct ion_heap *heap, struct ion_buffer *buffer,
                    ion_phys_addr_t *addr, size_t *len);
        struct scatterlist *(*map_dma) (struct ion_heap *heap,
                        struct ion_buffer *buffer);
        void (*unmap_dma) (struct ion_heap *heap, 
                 struct ion_buffer *buffer);
        void * (*map_kernel) (struct ion_heap *heap, 
                 struct ion_buffer *buffer);
        void (*unmap_kernel) (struct ion_heap *heap, 
                 struct ion_buffer *buffer);
        int (*map_user) (struct ion_heap *heap, struct ion_buffer *buffer,
                        struct vm_area_struct *vma);
   };
 
方法phys(),返回的是的物理地址和buffer的长度,但必须是连续的物理buffer,如果没有连续的物理buffer,是不能提供改回调。
map_kernel() and unmap_kernel(),把物理内存映射到kernel virtual address space.
map_user(),映射物理内存到用户空间,为啥没有unmap_user()方法呢,因为映射到用户空间,是以FD(文件描述符)的形式映射的,当FD close了就自动unmap。

 

ION可以释放内存嘛

答案是否定的。它主要的是提供给applications间共享内存。

IONPMem可以共存嘛?

可以,但是不能共享buffers.

 

userspace是如何使用ION?

1open ION device-------open("/dev/ion", O_RDONLY),返回一个FD(相当于ION client)

2:  客户端要填充如下数据结构,除了handle,也就是你要申请的data

struct ion_allocation_data {
        size_t len;
        size_t align;
        unsigned int flags;
        struct ion_handle *handle;
   }

3:  user space clients ioctlION通信

int ioctl(int client_fd, ION_IOC_ALLOC, struct ion_allocation_data *allocation_data)

返回的FDbuffer

4FD可以通过Binder机制进行进程间的share

 

如何查看ION的使用量

for example:

>adb shell

 #mount -t debugfs NONE /d

 #cd /d/ion/

 #ls

 922

 vmalloc

 ...

 # cat vmalloc

 cat vmalloc

 client pid size

 total bytes currently allocated: 0

 # cat 922

 cat 922

 heap_name: size_in_bytes : handle refcount : buffer

 client refcount: 1

 

ION 和DMABUF的比较:

Feature

ION

DMABUF

Memory Manager Role

ION replaces PMEM as the manager of provisioned memory pools. The list of ION heaps can be extended per device.

DMABUF is a buffer sharing framework, designed to integrate with the memory allocators in DMA mapping frameworks, like the work-in-progress DMA-contiguous allocator, also known as theContiguous Memory Allocator(CMA). DMABUF exporters have the option to implement custom allocators.

User Space Access Control

ION offers the /dev/ion interface for user-space programs to allocate and share buffers. Any user program with ION access can cripple the system by depleting the ION heaps. Android checks user and group IDs to block unauthorized access to ION heaps.

DMABUF offers only kernel APIs. Access control is a function of the permissions on the devices using the DMABUF feature.

Global Client and Buffer Database

ION contains a device driver associated with /dev/ion. The device structure contains a database that tracks the allocated ION buffers, handles and file descriptors, all grouped by user clients and kernel clients. ION validates all client calls according to the rules of the database. For example, there is a rule that a client cannot have two handles to the same buffer.

The DMA debug facility implements a global hashtable,dma_entry_hash, to track DMA buffers, but only when the kernel was built with theCONFIG_DMA_API_DEBUG option.

Cross-architecture Usage

ION usage today is limited to architectures that run the Android kernel.

DMABUF usage is cross-architecture. The DMA mapping redesign preparation patchset modified the DMA mapping code in 9 architectures besides the ARM architecture.

Buffer Synchronization

ION considers buffer synchronization to be an orthogonal problem.

DMABUF provides a pair of APIs for synchronization. The buffer-user callsdma_buf_map_attachment() whenever it wants to use the buffer for DMA . Once the DMA for the current buffer-user is over, it signals 'end-of-DMA' to the exporter via a call todma_buf_unmap_attachment().

Delayed Buffer Allocation

ION allocates the physical memory before the buffer is shared.

DMABUF can defer the allocation until the first call todma_buf_map_attachment(). The exporter of DMA buffer has the opportunity to scan all client attachments, collate their buffer constraints, then choose the appropriate backing storage.

 

 

http://www.jmfq.cn/news/4764133.html

相关文章:

  • 网站建设的目标是什么/网络营销推广
  • 校友会网站建设方案/怎么查找关键词排名
  • 如何做adsense网站/市场调研报告1500字
  • 青岛做网站建设哪家好/网站目录提交
  • 做减肥网站/app注册推广任务平台
  • 免费网站访问限制系统/网站seo优化分析
  • 优化方案化学/网站seo快速排名优化的软件
  • 贵阳手机网站建设公司/北京seo排名收费
  • 昆明seo网站推广/上海网络推广服务
  • 网站建设制作团队/市场调研方案怎么写
  • 做黄色网站多少年/有哪些平台可以做推广
  • 网站建设公司 跨界鱼科技优/关键词seo排名优化软件
  • 贵州成品网站/站长统计ios
  • seo优化网站模板/央视网新闻
  • 长沙做php的网站建设/最近的时事新闻
  • 建设部项目经理认证网站/百度一下就知道百度首页
  • 手机网站策划书方案/苹果cms永久免费全能建站程序
  • 代购网站怎么做/广西seo快速排名
  • 技术开发合同/郑州seo代理外包公司
  • 5个搜索引擎作弊的网站/seo优化的内容有哪些
  • 北京网站建设公司服务哪家好/南京百度快照优化排名
  • 网站建设硬件要求/seo网站建设优化
  • 宣传策划方案/电商seo优化是什么意思
  • 蓝色网站配色/武汉网站优化公司
  • 网站建设推广服务商/下载百度app并安装
  • 做网站费用怎么付/长沙网红奶茶
  • 网站的竞争对手/竞价托管开户
  • 郑州营销型网站建设哪家好/ui设计培训班哪家好
  • 免费策划方案平台/谷歌seo优化
  • 在线免费看1921完整版/班级优化大师下载