Re: get_user_pages() and shared memory question

From: Timur Tabi
Date: Tue Jun 21 2005 - 15:00:30 EST

Brice Goglin wrote:

Preventing the driver from doing this would probably be the
right solution here... If the driver called get_user_pages,
it is its responsibility to release the pages.

The driver does release the pages, but only when asked to do so. If the process dies, then the driver automatically cleans up, but otherwise how is the driver to know that the memory is no longer needed?

Perhaps you mean that the driver should release the pages before it exits. Unfortunately, that defeats the purpose of calling get_user_pages() in the first place. The driver needs to pin the application's buffers so that the subsequent DMA operations work. This driver supports an RDMA adapter that transfer network data directly to the application's buffers.

You're probably now thinking, "Well, why doesn't the driver just allocate the buffers on behalf of the app?" There are two reasons why we can't do that. One, the app may need have gigabytes of memory for the RDMA operations. Two, the APIs we need to support allow the app to allocate memory any way it sees fit.

Timur Tabi
Staff Software Engineer

One thing a Southern boy will never say is,
"I don't think duct tape will fix it."
-- Ed Smylie, NASA engineer for Apollo 13
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at