+ zram-correct-flag-name-of-zram_access.patch added to -mm tree

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

 



The patch titled
     Subject: zram: correct flag name of ZRAM_ACCESS
has been added to the -mm tree.  Its filename is
     zram-correct-flag-name-of-zram_access.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/zram-correct-flag-name-of-zram_access.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/zram-correct-flag-name-of-zram_access.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: correct flag name of ZRAM_ACCESS

Patch series "zram memory tracking", v5.

zRam as swap is useful for small memory device.  However, swap means those
pages on zram are mostly cold pages due to VM's LRU algorithm. 
Especially, once init data for application are touched for launching, they
tend to be not accessed any more and finally swapped out.  zRAM can store
such cold pages as compressed form but it's pointless to keep in memory. 
As well, it's pointless to store incompressible pages to zram so better
idea is app developers manages them directly like free or mlock rather
than remaining them on heap.

This patch provides a debugfs /sys/kernel/debug/zram/zram0/block_state to
represent each block's state so admin can investigate what memory is
cold|incompressible|same page with using pagemap once the pages are
swapped out.

The output is as follows:
      300    75.033841 .wh
      301    63.806904 s..
      302    63.806919 ..h

First column is zram's block index and 3rh one represents symbol (s: same
page w: written page to backing store h: huge page) of the block state. 
Second column represents usec time unit of the block was last accessed. 
So above example means the 300th block is accessed at 75.033851 second and
it was huge so it was written to the backing store.


This patch (of 4):

ZRAM_ACCESS is used for locking a slot of zram so correct the name.  It is
also not a common flag to indicate status of the block so move the declare
position on top of the flag.  Lastly, let's move the function to the top
of source code to be able to use it easily without forward declaration.

Link: http://lkml.kernel.org/r/20180416090946.63057-2-minchan@xxxxxxxxxx
Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/block/zram/zram_drv.c |   20 ++++++++++----------
 drivers/block/zram/zram_drv.h |    6 +++---
 2 files changed, 13 insertions(+), 13 deletions(-)

diff -puN drivers/block/zram/zram_drv.c~zram-correct-flag-name-of-zram_access drivers/block/zram/zram_drv.c
--- a/drivers/block/zram/zram_drv.c~zram-correct-flag-name-of-zram_access
+++ a/drivers/block/zram/zram_drv.c
@@ -52,6 +52,16 @@ static size_t huge_class_size;
 
 static void zram_free_page(struct zram *zram, size_t index);
 
+static void zram_slot_lock(struct zram *zram, u32 index)
+{
+	bit_spin_lock(ZRAM_LOCK, &zram->table[index].value);
+}
+
+static void zram_slot_unlock(struct zram *zram, u32 index)
+{
+	bit_spin_unlock(ZRAM_LOCK, &zram->table[index].value);
+}
+
 static inline bool init_done(struct zram *zram)
 {
 	return zram->disksize;
@@ -753,16 +763,6 @@ static DEVICE_ATTR_RO(io_stat);
 static DEVICE_ATTR_RO(mm_stat);
 static DEVICE_ATTR_RO(debug_stat);
 
-static void zram_slot_lock(struct zram *zram, u32 index)
-{
-	bit_spin_lock(ZRAM_ACCESS, &zram->table[index].value);
-}
-
-static void zram_slot_unlock(struct zram *zram, u32 index)
-{
-	bit_spin_unlock(ZRAM_ACCESS, &zram->table[index].value);
-}
-
 static void zram_meta_free(struct zram *zram, u64 disksize)
 {
 	size_t num_pages = disksize >> PAGE_SHIFT;
diff -puN drivers/block/zram/zram_drv.h~zram-correct-flag-name-of-zram_access drivers/block/zram/zram_drv.h
--- a/drivers/block/zram/zram_drv.h~zram-correct-flag-name-of-zram_access
+++ a/drivers/block/zram/zram_drv.h
@@ -43,9 +43,9 @@
 
 /* Flags for zram pages (table[page_no].value) */
 enum zram_pageflags {
-	/* Page consists the same element */
-	ZRAM_SAME = ZRAM_FLAG_SHIFT,
-	ZRAM_ACCESS,	/* page is now accessed */
+	/* zram slot is locked */
+	ZRAM_LOCK = ZRAM_FLAG_SHIFT,
+	ZRAM_SAME,	/* Page consists the same element */
 	ZRAM_WB,	/* page is stored on backing_device */
 
 	__NR_ZRAM_PAGEFLAGS,
_

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

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

--
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