SUNRPC: Add trace event when alloc_pages_bulk() makes no progress
authorChuck Lever <chuck.lever@oracle.com>
Mon, 4 Oct 2021 14:16:26 +0000 (10:16 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 4 Oct 2021 19:40:15 +0000 (15:40 -0400)
This is an operational low memory situation that needs to be
flagged. The new tracepoint records a timestamp and the nfsd thread
that failed to allocate pages.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/trace/events/sunrpc.h
net/sunrpc/svc_xprt.c

index 2d04eb96d41838bbc57613b73816bee92a4028d5..fb016308c18596dece630eabf4c6cfac3d855f4c 100644 (file)
@@ -1859,6 +1859,24 @@ TRACE_EVENT(svc_wake_up,
        TP_printk("pid=%d", __entry->pid)
 );
 
+TRACE_EVENT(svc_alloc_arg_err,
+       TP_PROTO(
+               unsigned int pages
+       ),
+
+       TP_ARGS(pages),
+
+       TP_STRUCT__entry(
+               __field(unsigned int, pages)
+       ),
+
+       TP_fast_assign(
+               __entry->pages = pages;
+       ),
+
+       TP_printk("pages=%u", __entry->pages)
+);
+
 TRACE_EVENT(svc_handle_xprt,
        TP_PROTO(struct svc_xprt *xprt, int len),
 
index 6316bd2b8f37bc8170b5c83a6fdd695466752e0c..1e99ba1b9d723d007ec3a00044b5ff922b7d8e56 100644 (file)
@@ -687,6 +687,7 @@ static int svc_alloc_arg(struct svc_rqst *rqstp)
                        set_current_state(TASK_RUNNING);
                        return -EINTR;
                }
+               trace_svc_alloc_arg_err(pages);
                schedule_timeout(msecs_to_jiffies(500));
        }
        rqstp->rq_page_end = &rqstp->rq_pages[pages];