阅读:1536回复:11
关于direct_io
很想知道direct_io分配的内存是分页的还是非分页的,还是就是他在分配的大小上有没有限制?
另外:当用direct_io方式传多个IRP下去,内核是在一收到IRP就建立MDL,还是在处理当前IRP才建立MDL的? |
|
沙发#
发布于:2002-08-18 21:36
in dispatch level, when you want to access pagable memory,
do like following: mark pending irp. quueworkitemex, return peding status (DO not complete it). in work queue, because it\'s in passive level, do as you like then complete irp. in filedisk or filemon anything else, there is much example about how to lower a irp. you can not use KeLowerIrql to low a irp which was not raised by youself (use KeRaiseIrql). so use workitem or system thread maybe best and only way. good luck. |
|
板凳#
发布于:2002-08-17 18:42
Rifter, RtlCopyMemory can be used at Dispatch level. The problem is that the Virtual Address of paged memory can\'t be used. You can try to lock the memory in passive level and use it at Dispatch level. |
|
地板#
发布于:2002-08-17 01:21
That\'s for zdhe :)
Rifter, thanks for raising the question also :) |
|
地下室#
发布于:2002-08-17 01:19
Rifter,
I learned a lot from your posting. My problem now is I am trying to copy a packet from a nondispatch routine to the Irp\'s buffer, but since there is no Irp in the parameter list, how can I get the Irp and the DeviceObject? Second, suppose I can get the Irp, but this routine is at Dispatch level, so the RtlCopyMemory ... can\'t be used, is there anyway I can decrease the IRQL level of this routine or is there any other ways to get the packet cpied? Thanks in advance! zyh |
|
5楼#
发布于:2002-08-16 12:34
MDL只是描述子而已,描述的内存可以十分也得也可以是不页的(不是cpu的页概念,明确的说这个页是pagafile swapable or not)。 懂了懂了,帮我看看 我的其他几片帖子,关于STOP停机的问题 |
|
|
6楼#
发布于:2002-08-16 11:21
MDL只是描述子而已,描述的内存可以十分也得也可以是不页的(不是cpu的页概念,明确的说这个页是pagafile swapable or not)。
只要driver访问时的irql低于dispatch level, 分页内存也可以使用。 对于directio,系统会把buffer lock在物理内存中,然后做成一个mdl供driver使用。 从这个意义上,directio是不分页的。当时使用可能的物理mem如果不足,自然lock就失败,这个内存永远不会大于可用物理内存。 |
|
7楼#
发布于:2002-08-16 10:50
就是就是,我非常同意gung的看法,不过真的要感谢arthurtu。
还有我觉得内核如果在处理当前的IRP才建立MDL更为合理,也就是说只有在真正用到他的时候我们才用MDL来描述他,这样比较节省资源。 |
|
8楼#
发布于:2002-08-16 10:31
mdl在irp里面,irp是不分页的。你说呢? mdl虽然在非分页内存中,但mdl描述的内存可以是分页的吧,我觉得irp中所带的内存如果只能是非分页的总是会有所局限吧,非分页内存总不好申请太大吧。 自己瞎猜,不懂的说 :D |
|
9楼#
发布于:2002-08-16 10:24
mdl在irp里面,irp是不分页的。你说呢?
当然不能大于物理内存。 :D :D 到底能多大,也不清楚,可能和当时的环境有关系。 |
|
10楼#
发布于:2002-08-16 10:12
对不起,我没有说清楚。我的意思就是在用direct_io方式的时候,内核在用MDL去描述应用程序传下来的buffer,那么这个buffer映射到内核中是否是分页的呢?还有就是他的大小有限制吗?
|
|
11楼#
发布于:2002-08-16 09:45
什么叫direct_io分配的内存?
在建立irp的时候,就包括mdl了 |
|