From: Shailabh Nagar <nagar@watson.ibm.com>
To: Shailabh Nagar <nagar@watson.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
elsa-devel <elsa-devel@lists.sourceforge.net>,
lse-tech@lists.sourceforge.net,
ckrm-tech <ckrm-tech@lists.sourceforge.net>,
Guillaume Thouvenin <guillaume.thouvenin@bull.net>,
Jay Lan <jlan@sgi.com>, Jens Axboe <axboe@suse.de>
Subject: [RFC][Patch 4/5] Per-task delay accounting: Swap in delays
Date: Wed, 07 Dec 2005 22:28:27 +0000 [thread overview]
Message-ID: <4397620B.1070303@watson.ibm.com> (raw)
In-Reply-To: <43975D45.3080801@watson.ibm.com>
Changes since 11/14/05
- use nanosecond resolution, adjusted wall clock time for timestamps
instead of sched_clock (akpm, andi, marcelo)
- collect stats only if delay accounting enabled (parag)
- collect delays for only swapin page faults instead of all page faults.
11/14/05: First post
delayacct-swapin.patch
Record time spent by a task waiting for its pages to be swapped in.
This statistic can help in adjusting the rss limits of
tasks (process), especially relative to each other, when the system is
under memory pressure.
Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
include/linux/delayacct.h | 3 +++
include/linux/sched.h | 2 ++
mm/memory.c | 16 +++++++++-------
3 files changed, 14 insertions(+), 7 deletions(-)
Index: linux-2.6.15-rc5/include/linux/delayacct.h
===================================================================
--- linux-2.6.15-rc5.orig/include/linux/delayacct.h
+++ linux-2.6.15-rc5/include/linux/delayacct.h
@@ -20,11 +20,14 @@
extern int delayacct_on; /* Delay accounting turned on/off */
extern void delayacct_tsk_init(struct task_struct *tsk);
extern void delayacct_blkio(struct timespec *start, struct timespec *end);
+extern void delayacct_swapin(struct timespec *start, struct timespec *end);
#else
static inline void delayacct_tsk_init(struct task_struct *tsk)
{}
static inline void delayacct_blkio(struct timespec *start, struct timespec *end)
{}
+static inline void delayacct_swapin(struct timespec *start, struct timespec *end)
+{}
#endif /* CONFIG_TASK_DELAY_ACCT */
#endif /* _LINUX_TASKDELAYS_H */
Index: linux-2.6.15-rc5/include/linux/sched.h
===================================================================
--- linux-2.6.15-rc5.orig/include/linux/sched.h
+++ linux-2.6.15-rc5/include/linux/sched.h
@@ -548,6 +548,8 @@ struct task_delay_info {
/* Add stats in pairs: uint64_t delay, uint32_t count */
uint64_t blkio_delay; /* wait for sync block io completion */
uint32_t blkio_count;
+ uint64_t swapin_delay; /* wait for pages to be swapped in */
+ uint32_t swapin_count;
};
#endif
Index: linux-2.6.15-rc5/mm/memory.c
===================================================================
--- linux-2.6.15-rc5.orig/mm/memory.c
+++ linux-2.6.15-rc5/mm/memory.c
@@ -2201,16 +2201,15 @@ static inline int handle_pte_fault(struc
old_entry = entry = *pte;
if (!pte_present(entry)) {
- if (pte_none(entry)) {
- int ret;
- __attribute__((unused)) struct timespec start, end;
+ int ret;
+ __attribute__((unused)) struct timespec start, end;
+ getnstimestamp(&start);
+ if (pte_none(entry)) {
if (!vma->vm_ops || !vma->vm_ops->nopage)
return do_anonymous_page(mm, vma, address,
pte, pmd, write_access);
- if (vma->vm_file)
- getnstimestamp(&start);
ret = do_no_page(mm, vma, address,
pte, pmd, write_access);
if (vma->vm_file) {
@@ -2222,8 +2221,11 @@ static inline int handle_pte_fault(struc
if (pte_file(entry))
return do_file_page(mm, vma, address,
pte, pmd, write_access, entry);
- return do_swap_page(mm, vma, address,
- pte, pmd, write_access, entry);
+ ret = do_swap_page(mm, vma, address,
+ pte, pmd, write_access, entry);
+ getnstimestamp(&end);
+ delayacct_swapin(&start, &end);
+ return ret;
}
ptl = pte_lockptr(mm, pmd);
next prev parent reply other threads:[~2005-12-07 22:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-07 22:08 [RFC][Patch 0/5] Per-task delay accounting Shailabh Nagar
2005-12-07 22:13 ` [RFC][Patch 1/5] nanosecond timestamps and diffs Shailabh Nagar
2005-12-12 18:50 ` [Lse-tech] " Christoph Lameter
2005-12-12 19:31 ` Shailabh Nagar
2005-12-12 19:49 ` john stultz
2005-12-12 20:00 ` Shailabh Nagar
2005-12-12 20:07 ` john stultz
2005-12-13 0:54 ` George Anzinger
2005-12-13 3:48 ` Nish Aravamudan
2005-12-13 18:35 ` Jay Lan
2005-12-13 21:16 ` john stultz
2005-12-13 21:44 ` Shailabh Nagar
2005-12-13 22:13 ` George Anzinger
2005-12-13 23:05 ` [ckrm-tech] " Matt Helsley
2005-12-07 22:15 ` [RFC][Patch 2/5] Per-task delay accounting: Initialization, dynamic turn on/off Shailabh Nagar
2005-12-07 22:23 ` [RFC][Patch 3/5] Per-task delay accounting: Sync block I/O delays Shailabh Nagar
2005-12-07 22:33 ` [ckrm-tech] " Dave Hansen
2005-12-07 23:06 ` Shailabh Nagar
2005-12-07 22:28 ` Shailabh Nagar [this message]
2005-12-07 22:29 ` [RFC][Patch 5/5] Per-task delay accounting: procfs interface Shailabh Nagar
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=4397620B.1070303@watson.ibm.com \
--to=nagar@watson.ibm.com \
--cc=axboe@suse.de \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=elsa-devel@lists.sourceforge.net \
--cc=guillaume.thouvenin@bull.net \
--cc=jlan@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
/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