From: Shuvabrata Ganguly <sganguly@cse.iitkgp.ernet.in>
To: "Stephen C. Tweedie" <sct@redhat.com>, linux MM <linux-mm@kvack.org>
Subject: Re: Question about pte_alloc()
Date: Thu, 16 Nov 2000 15:32:19 -0500 [thread overview]
Message-ID: <3A144453.D0724CC1@cse.iitkgp.ernet.in> (raw)
In-Reply-To: <20001115154729.H3186@redhat.com>
"Stephen C. Tweedie" wrote:
> Hi,
>
> On Wed, Nov 15, 2000 at 07:04:00PM -0500, Shuvabrata Ganguly wrote:
>
> > "Stephen C. Tweedie" wrote:
> >
> > > On Wed, Nov 15, 2000 at 02:07:38AM -0500, Shuvabrata Ganguly wrote:
> > > > it appears from the code that pte_alloc() might block since it allocates
> > > > a page table with GFP_KERNEL if the page table doesnt already exist. i
> > > > need to call pte_alloc() at interrupt time.
> > >
> > > You cannot safely play pte games at interrupt time. You _must_ do
> > > this in the foreground.
> >
> > why is that ?
>
> Because the locking mechanisms used to protect ptes on SMP machines
> are not interrupt-safe, and because even on uni-processors, we may
> perform non-atomic operations on the page tables (such as various
> read-modify-write cycles) which will break if an interrupt occurs in
> the middle of the cycle and modifies the pte.
>
point understood. i got that from the code.
>
> > > Why can't you just let the application know that the event has
> > > occurred and then let it mmap the data itself?
> >
> > Two reasons:-
> > i) since kernel memory is unswappable i dont want to allocate a big buffer
> > and transfer it to the user when the device has filled it with data. instead
> > i want to allocate a page, fill it with data and give it to the user process.
> >
> > ii) if i allocate in pages and let the user know that a page of data has
> > arrived, it will take a lot of context switches.
>
> I don't buy that. The user process _has_ to wait if there's no data
> ready, surely?
well i did not mention earlier what i am trying to do. i are trying to implement a
zero-copy light-weight protocol for PVM. the PVM task can do computation instead
of waiting for data to arrive. when it needs data it calls read to get the data .
if the data has not arrived yet _then_ it would wait. it would really help if i
could tranfer pages of a msg buffer to the user without the process knowing
....then keep a pointer to that buffer in the rx_queue and pass this pointer to
the process when it calls read.
> It doesn't matter how you are passing the data around.
>
> > basically i want the kernel to allocate memory on behalf of a process, and
> > pass the virtual address of that buffer to the user when it does a read. this
> > is somewhat like the "fbuf" scheme.
>
> There are a number of ways you could do that without messiness in the
> VM. You could allocate a small number of pages at once, mmap()
> them and use that as a ring buffer to the application. Basically,
> establishing a new kernel buffer mapping from user space IS the mmap()
> operation --- why not use mmap for it? The corresponding munmap when the
> application has finished using the data lets the kernel know exactly when the
> page can be recycled.
i know that. but i dont want to wire the pages. i want the driver to allocate
pages, fill them up with data and then transfer them to the user, which would
enable the kernel to swap them but then i cant touch page tables at interrupt
time.
> Cheers,
> Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
next prev parent reply other threads:[~2000-11-16 20:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-15 7:07 Shuvabrata Ganguly
2000-11-14 20:51 ` Kanoj Sarcar
2000-11-15 10:56 ` Stephen C. Tweedie
2000-11-16 0:04 ` Shuvabrata Ganguly
2000-11-15 15:47 ` Stephen C. Tweedie
2000-11-16 20:32 ` Shuvabrata Ganguly [this message]
2000-11-16 14:37 ` Ingo Oeser
2000-11-15 15:20 Mark_H_Johnson
2000-11-15 15:34 ` Stephen C. Tweedie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3A144453.D0724CC1@cse.iitkgp.ernet.in \
--to=sganguly@cse.iitkgp.ernet.in \
--cc=linux-mm@kvack.org \
--cc=sct@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox