+ zram-introduce-zram-memory-tracking-update.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: zram-introduce-zram-memory-tracking-update
has been added to the -mm tree.  Its filename is
     zram-introduce-zram-memory-tracking-update.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/zram-introduce-zram-memory-tracking-update.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/zram-introduce-zram-memory-tracking-update.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Minchan Kim <minchan@xxxxxxxxxx>
Subject: zram-introduce-zram-memory-tracking-update

use ktime_get_boottime() instead of sched_clock()

Link: http://lkml.kernel.org/r/20180420063525.GA253739@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 Documentation/blockdev/zram.txt |    2 +-
 drivers/block/zram/zram_drv.c   |   19 +++++--------------
 drivers/block/zram/zram_drv.h   |    2 +-
 3 files changed, 7 insertions(+), 16 deletions(-)

diff -puN Documentation/blockdev/zram.txt~zram-introduce-zram-memory-tracking-update Documentation/blockdev/zram.txt
--- a/Documentation/blockdev/zram.txt~zram-introduce-zram-memory-tracking-update
+++ a/Documentation/blockdev/zram.txt
@@ -256,7 +256,7 @@ If you enable the feature, you could see
 	  302    63.806919 ..h
 
 First column is zram's block index.
-Second column is access time.
+Second column is access time since the system is boot
 Third column is state of the block.
 (s: same page
 w: written page to backing store
diff -puN drivers/block/zram/zram_drv.c~zram-introduce-zram-memory-tracking-update drivers/block/zram/zram_drv.c
--- a/drivers/block/zram/zram_drv.c~zram-introduce-zram-memory-tracking-update
+++ a/drivers/block/zram/zram_drv.c
@@ -634,7 +634,7 @@ static void zram_debugfs_destroy(void)
 
 static void zram_accessed(struct zram *zram, u32 index)
 {
-	zram->table[index].ac_time = sched_clock();
+	zram->table[index].ac_time = ktime_get_boottime();
 }
 
 static void zram_reset_access(struct zram *zram, u32 index)
@@ -642,22 +642,14 @@ static void zram_reset_access(struct zra
 	zram->table[index].ac_time = 0;
 }
 
-static long long ns2usecs(u64 nsec)
-{
-	nsec += 500;
-	do_div(nsec, 1000);
-	return nsec;
-}
-
 static ssize_t read_block_state(struct file *file, char __user *buf,
 				size_t count, loff_t *ppos)
 {
 	char *kbuf;
 	ssize_t index, written = 0;
 	struct zram *zram = file->private_data;
-	u64 last_access;
-	unsigned long usec_rem;
 	unsigned long nr_pages = zram->disksize >> PAGE_SHIFT;
+	struct timespec64 ts;
 
 	kbuf = kvmalloc(count, GFP_KERNEL);
 	if (!kbuf)
@@ -677,11 +669,10 @@ static ssize_t read_block_state(struct f
 		if (!zram_allocated(zram, index))
 			goto next;
 
-		last_access = ns2usecs(zram->table[index].ac_time);
-		usec_rem = do_div(last_access, USEC_PER_SEC);
+		ts = ktime_to_timespec64(zram->table[index].ac_time);
 		copied = snprintf(kbuf + written, count,
-			"%12lu %5lu.%06lu %c%c%c\n",
-			index, (unsigned long)last_access, usec_rem,
+			"%12lu %12lu.%06lu %c%c%c\n",
+			index, ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC,
 			zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
 			zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',
 			zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.');
diff -puN drivers/block/zram/zram_drv.h~zram-introduce-zram-memory-tracking-update drivers/block/zram/zram_drv.h
--- a/drivers/block/zram/zram_drv.h~zram-introduce-zram-memory-tracking-update
+++ a/drivers/block/zram/zram_drv.h
@@ -62,7 +62,7 @@ struct zram_table_entry {
 	};
 	unsigned long value;
 #ifdef CONFIG_ZRAM_MEMORY_TRACKING
-	u64 ac_time;
+	ktime_t ac_time;
 #endif
 };
 
_

Patches currently in -mm which might be from minchan@xxxxxxxxxx are

mm-memcg-add-__gfp_nowarn-in-__memcg_schedule_kmem_cache_create.patch
zram-correct-flag-name-of-zram_access.patch
zram-mark-incompressible-page-as-zram_huge.patch
zram-record-accessed-second.patch
zram-introduce-zram-memory-tracking.patch
zram-introduce-zram-memory-tracking-update.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux