Re: [2/3 PATCH] Kprobes: User space probes support- readpage hooks

From: Andrew Morton
Date: Mon Mar 20 2006 - 05:56:29 EST

Prasanna S Panchamukhi <prasanna@xxxxxxxxxx> wrote:
> This patch provides the feature of inserting probes on pages that are
> not present in the memory during registration.
> To add readpage and readpages() hooks, two new elements are added to
> the uprobe_module object:
> struct address_space_operations *ori_a_ops;
> struct address_space_operations user_a_ops;
> User-space probes allows probes to be inserted even in pages that are
> not present in the memory at the time of registration. This is done
> by adding hooks to the readpage and readpages routines. During
> registration, the address space operation object is modified by
> substituting user-space probes's specific readpage and readpages
> routines. When the pages are read into memory through the readpage and
> readpages address space operations, any associated probes are
> automatically inserted into those pages. These user-space probes
> readpage and readpages routines internally call the original
> readpage() and readpages() routines, and then check whether probes are
> to be added to these pages, inserting probes as necessary. The
> overhead of adding these hooks is limited to the application on which
> the probes are inserted.
> During unregistration, care should be taken to replace the readpage and
> readpages hooks with the original routines if no probes remain on that
> application.

So... The code's replacing the address_space's address_space_operations
with a copy which has .readpage() and .readpages() modified, because it
happens that filemap_nopage() uses those.

This is all rather hacky.

I think we need to step back and discuss what services this feature is
trying to provide, and how it is to provide them. Your covering
description didn't describe that - it dives straigt into details without
even describing what the patches are trying to achieve.

So. What are we trying to achieve here, and how are we trying to achieve
it? What problems were encountered in the development of the feature and
how were they solved? What alternative solutions were there?

I can mostly work all that out from background knowledge and looking at the
code, but I'd rather hear it from the designers please.
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