<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2>Doron</FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff size=2>You
can work on 2.6.24 if you prefer. I just picked some version and checked on it.
(for some reason there is no arch/i386 in 2.6.24. Maybe they have renamed it
into x86?)</FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff size=2>As for
which function to use:</FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff size=2>What
you want to change is not the place where the io request is done, but the
place where the process puts itself in the wait queue, removes itself from the
runqueue and calls for schedule().</FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff size=2>In
2.6.11 this is done in function <SPAN><FONT face=Arial color=#0000ff
size=2>block_wait_queue_running(q).</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN>I have not checked what <FONT face="Times New Roman" color=#000000
size=3>q->make_request_fn(q,bio)" does exactly, but from your
description, it issues a request to the driver. This is probably done by simply
adding some request struct with instruction on what to do to the driver request
data structure (and maybe signaling the driver in some way). After doing that
the process puts itself to sleep (via <SPAN><FONT face=Arial color=#0000ff
size=2>block_wait_queue_running</FONT></SPAN>).</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN><FONT face="Times New Roman" color=#000000 size=3>When the driver
finishes handling the request (A LOT OF time from now), it raises HW
interrupt</FONT> <FONT face="Times New Roman" color=#000000 size=3>and this
interrupt will wake the waiting process and put it back in the run queue.
Sometime later the process will be scheduled to run and it will continue from
the next place after the call for schedule().</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN>Gabi</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN>P.S. I think it would be wise to check first what Muli has
suggested - compare times. </SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=359153815-18092008><FONT face=Arial color=#0000ff
size=2><SPAN> </SPAN></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Doron Zuckerman
[mailto:doron.zuckerman@gmail.com] <BR><B>Sent:</B> Thursday, September 18, 2008
6:29 PM<BR><B>To:</B> gabik; haifux@haifux.org<BR><B>Cc:</B> Ronen
Gruengras<BR><B>Subject:</B> Re: [Haifux] SSD and linux<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>Hi Gabi,<BR><BR>First of all thanks for you're help.<BR><BR>We are
currently using kernel 2.6.24, and couldn't find any call to the function
"<SPAN><FONT face=Arial color=#0000ff size=2>block_wait_queue_running(q)"
</FONT></SPAN>there. It seems to handle things a bit
differently.<BR><BR>Moreover I looked at the code of kernel 2.6.11 and from what
I can understand, it seems to me like the "<SPAN><FONT face=Arial color=#0000ff
size=2>block_wait_queue_running(q)" </FONT></SPAN>function only waits on the IO
queue for the IO to be ready, and not for the IO request (reading the page from
the disk) to be done (it is called before the IO request is
made).<BR><BR>Correct me if I'm wrong but isn't the call to the function
"q->make_request_fn(q,bio)" what makes the actual request to the device, and
therefore the place which is responsible for waiting for the result of that
request?<BR><BR>P.S.<BR>I don't mind switching to kernel 2.6.11 (or any other
for that matter) as long as I can make the changes I
need.<BR><BR>Thanks,<BR>Ronen & Doron<BR><BR>
<DIV class=gmail_quote>On Thu, Sep 18, 2008 at 4:49 PM, gabik <SPAN
dir=ltr><<A
href="mailto:gabik@cs.technion.ac.il">gabik@cs.technion.ac.il</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Hi Doron</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>The place where the current
process goes to sleep and waits until the page is swapped in is indeed in
generic_make_request() (called from submit_bio())</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>There is a call
to block_wait_queue_running(q); which moves this process to wait and
calls for schedule() [prepare_to_wait_exclusive() and after that
io_schedule()].</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Thus, this seems to be a
place <SPAN>for</SPAN> a busy loop.</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>You must be careful though
with what you change and make sure not to break some other code path, that
assumes certain things done in this code path.</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2><SPAN>For example, if you are
not going to put this process in the wait queue, you must be careful what will
happen when the io operation will finish and will want to remove this process
from the wait queue and wake it up.</SPAN></FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Gabi</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>P.S. I was referring to
version 2.6.11</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2><A
href="http://lxr.linux.no/linux+v2.6.11/drivers/block/ll_rw_blk.c#L2595"
target=_blank>http://lxr.linux.no/linux+v2.6.11/drivers/block/ll_rw_blk.c#L2595</A></FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV></DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> Doron Zuckerman [mailto:<A
href="https://mail.google.com/mail?view=cm&tf=0&to=doron.zuckerman@gmail.com"
target=_blank>doron.zuckerman@gmail.com</A>] <BR><B>Sent:</B> Thursday,
September 18, 2008 12:28 PM<BR><B>To:</B> <A
href="https://mail.google.com/mail?view=cm&tf=0&to=muli@il.ibm.com"
target=_blank>muli@il.ibm.com</A>; <A
href="https://mail.google.com/mail?view=cm&tf=0&to=gabik@cs.technion.ac.il"
target=_blank>gabik@cs.technion.ac.il</A>; <A
href="https://mail.google.com/mail?view=cm&tf=0&to=haifux@haifux.org"
target=_blank>haifux@haifux.org</A><BR><B>Subject:</B> Re: [Haifux] SSD and
linux<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>
<DIV></DIV>
<DIV dir=ltr>Hi Gabi and Muli,<BR>I'm sorry about the mistake- you understood
me correctly.<BR><BR>I'm not sure it will speed up the OS, however I'm doing
an academic research on the matter as part of a project I'm taking, and I plan
to check this point.<BR>The leading thought was that since the SSD is not a
mechanical drive, pages can be brought faster in this way, and there is no
need to context switch, thus, avoiding the overhead included.<BR><BR>Yes I
plan to use the polling system (busy-wait) , and I'm looking for the kernel
part in the pagefault handling mechanism in which the process is
suspended in order to prevent it.<BR><BR>So far I found the function
"__generic_make_request" in file "ll_blk".<BR>This function calls a sub
function named "might_sleep".<BR>I have deleted the call to this function
whenever I'm in a pagefault, however I'm not sure if this function casuses the
sleep, or is just used for debugging in order to check if we entered a suspend
state.<BR><BR>My question is if this is the function I should change in order
to accept the change I'm willing to get, or if the change should be made in
q->make_request_fn<BR>which, according to my understanding, belongs to the
specific driver I'm using.<BR><BR>Please help me find the specific place I'm
looking for that would make the desired change.<BR><BR>Thank you very
much,<BR>Doron.<BR><BR>
<DIV class=gmail_quote>On Tue, Sep 16, 2008 at 2:42 PM, gabik <SPAN
dir=ltr><<A
href="https://mail.google.com/mail?view=cm&tf=0&to=gabik@cs.technion.ac.il"
target=_blank>gabik@cs.technion.ac.il</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Hello
Doron</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Why do you think it will
speed up the OS?</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>What do you plan to do
until the page is swapped in? Busy loop?</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>About your
solution:</FONT></SPAN></DIV>
<DIV><SPAN>handle_mm_fault is called from within page fault handler (<A
href="http://lxr.linux.no/linux+v2.6.26.5/+code=do_page_fault"
target=_blank>do_page_fault</A>()).</SPAN></DIV>
<DIV><SPAN>So what is the rational behind calling <SPAN>handle_mm_fault not
from inside pagefault handler?</SPAN></SPAN></DIV>
<DIV><SPAN><SPAN>Where would you call it from instead and what do you plan
to do when you are in the page fault?</SPAN></SPAN></DIV>
<DIV><SPAN><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN><SPAN><FONT face=Arial color=#0000ff size=2>Probably what you
meant is, in order not to do context switch due to page fault, is to call
<SPAN><FONT face="Times New Roman" color=#000000 size=3>handle_mm_fault as
usual, but not to raise need_resched flag, so as not to trigger a context
switch in case of a major page
fault.</FONT></SPAN></FONT></SPAN></SPAN></DIV>
<DIV><SPAN><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Gabi</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN></SPAN> </DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
href="https://mail.google.com/mail?view=cm&tf=0&to=haifux-bounces@haifux.org"
target=_blank>haifux-bounces@haifux.org</A> [mailto:<A
href="https://mail.google.com/mail?view=cm&tf=0&to=haifux-bounces@haifux.org"
target=_blank>haifux-bounces@haifux.org</A>] <B>On Behalf Of </B>Doron
Zuckerman<BR><B>Sent:</B> Tuesday, September 16, 2008 12:31 PM<BR><B>To:</B>
<A
href="https://mail.google.com/mail?view=cm&tf=0&to=haifux@haifux.org"
target=_blank>haifux@haifux.org</A><BR><B>Cc:</B> Ronen
Gruengras<BR><B>Subject:</B> [Haifux] SSD and linux<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV>
<DIV></DIV>
<DIV dir=ltr>Hi all,<BR><BR>I have a question regarding the linux kernel
(for those of you who are familiar with it).<BR><BR>I'm looking for a way to
add a change to the linux kernel in order to check if I can make it more
compatible with my Asus EEE-PC.<BR>I would like to change the kernel in such
way that it will not do a context switch every time there is a page fault
<BR>and will wait for the required page to be brought from the SSD (Solid
State Drive), then continue as usual.<BR>In Such way, I plan to check if I
can fasten the speed of the Operating System (Ubuntu for EEE).<BR>I thought
of adding a TIF flag in the process descriptor (thread_info_32.h) that will
tell me if I'm currently in a pagefault and <BR>then change the fault_32.c
in such way that it will do the "handle_mm_fault(mm,vma, address, write_;"
only if there is no <BR>pagefault at the moment.<BR>Can you suggest any
other solution possible or tell me what you think about this
solution.<BR><BR>I would really appreciate any help with
this,<BR>Doron.<BR><BR><BR></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>