xxxxx@gmail.com wrote:
“What would lead you to that conclusion?” Tim Roberts
1-) Never allocate dispatcher objects from a paged pool
2-) dispatcher objects are manipulated by the dispatcher at (…) DISPATCH_LEVEL
3-) you cannot handle a page fault at dispatch
I think I just combined 3 piece of information. So I concluded page-fault handler must run at dispatch_level and dispatcher runs at dispatch_level so dispatcher handle page faults. But this is wrong.
I see your reasoning. Yes, “dispatch_level” is used in many cases other
than by the dispatcher.
Is that right: For example Scheduler selects a thread but it is paged-out so it calls or selects(?) page fault handler, page fault handler brings its pages, and after that scheduler makes the thread runs. Right?
Not exactly. The kernel thread data structures themselves are never
paged out. The process memory space might be paged out, but the
scheduler doesn’t worry about that. It merely selects the thread and
starts it executing. If the very first instruction that thread runs
happens to be paged out, then the process will immediately get a
user-mode page fault (from the processor chip itself). The page fault
handler will read in the page, and the thread continues on until it
touches another page that is paged out.
In all but some very exceptional cases, paging can simply be ignored.
It is something that happens magically in the background. You can
pretend that memory is infinite. The only time this model fails is when
you are at a raised IRQL.
If right, it can also makes page fault brings back the paged-out dispatcher object. (This is the confusion that I am trying to figure out)
Page faults cause a processor interrupt. The page fault handler runs as
the interrupt request handler for the page fault exception. The
conflict with raised IRQL code is that you do not want it to be
interrupted. The kernel often needs to run through its lists of pending
dispatcher objects, and that process also runs at a raised IRQL (to
prevent interrupts). Thus, there is a requirement that dispatcher
objects never be paged out.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.