mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuo-Hsin Yang <vovoy@chromium.org>
To: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	linux-mm@kvack.org
Cc: mhocko@suse.com, akpm@linux-foundation.org,
	chris@chris-wilson.co.uk, peterz@infradead.org,
	dave.hansen@intel.com, corbet@lwn.net, hughd@google.com,
	joonas.lahtinen@linux.intel.com, marcheu@chromium.org,
	hoegsberg@chromium.org, Kuo-Hsin Yang <vovoy@chromium.org>
Subject: [PATCH 1/2] shmem: export shmem_unlock_mapping
Date: Wed, 17 Oct 2018 01:42:59 +0800	[thread overview]
Message-ID: <20181016174300.197906-2-vovoy@chromium.org> (raw)
In-Reply-To: <20181016174300.197906-1-vovoy@chromium.org>

By exporting this function, drivers can mark/unmark a shmemfs address
space as unevictable in the following way: 1. mark an address space as
unevictable with mapping_set_unevictable(), pages in the address space
will be moved to unevictable list in vmscan. 2. mark an address space
evictable with mapping_clear_unevictable(), and move these pages back to
evictable list with shmem_unlock_mapping().

Signed-off-by: Kuo-Hsin Yang <vovoy@chromium.org>
---
 Documentation/vm/unevictable-lru.rst | 4 +++-
 mm/shmem.c                           | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/vm/unevictable-lru.rst b/Documentation/vm/unevictable-lru.rst
index fdd84cb8d511..a812fb55136d 100644
--- a/Documentation/vm/unevictable-lru.rst
+++ b/Documentation/vm/unevictable-lru.rst
@@ -143,7 +143,7 @@ using a number of wrapper functions:
 	Query the address space, and return true if it is completely
 	unevictable.
 
-These are currently used in two places in the kernel:
+These are currently used in three places in the kernel:
 
  (1) By ramfs to mark the address spaces of its inodes when they are created,
      and this mark remains for the life of the inode.
@@ -154,6 +154,8 @@ These are currently used in two places in the kernel:
      swapped out; the application must touch the pages manually if it wants to
      ensure they're in memory.
 
+ (3) By the i915 driver to mark pinned address space until it's unpinned.
+
 
 Detecting Unevictable Pages
 ---------------------------
diff --git a/mm/shmem.c b/mm/shmem.c
index 446942677cd4..d1ce34c09df6 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -786,6 +786,7 @@ void shmem_unlock_mapping(struct address_space *mapping)
 		cond_resched();
 	}
 }
+EXPORT_SYMBOL_GPL(shmem_unlock_mapping);
 
 /*
  * Remove range of pages and swap entries from radix tree, and free them.
@@ -3874,6 +3875,7 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
 void shmem_unlock_mapping(struct address_space *mapping)
 {
 }
+EXPORT_SYMBOL_GPL(shmem_unlock_mapping);
 
 #ifdef CONFIG_MMU
 unsigned long shmem_get_unmapped_area(struct file *file,
-- 
2.19.1.331.ge82ca0e54c-goog


  reply	other threads:[~2018-10-16 17:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 17:42 [PATCH 0/2] shmem, drm/i915: Mark pinned shmemfs pages as unevictable Kuo-Hsin Yang
2018-10-16 17:42 ` Kuo-Hsin Yang [this message]
2018-10-16 17:43 ` [PATCH 2/2] " Kuo-Hsin Yang
2018-10-16 18:21   ` Michal Hocko
2018-10-16 18:31     ` Chris Wilson
2018-10-16 19:13       ` Michal Hocko
2018-10-18  6:56       ` Chris Wilson
2018-10-18  8:15         ` Michal Hocko
2018-10-17  8:58 ` [PATCH v2] shmem, drm/i915: mark " Kuo-Hsin Yang

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=20181016174300.197906-2-vovoy@chromium.org \
    --to=vovoy@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@intel.com \
    --cc=hoegsberg@chromium.org \
    --cc=hughd@google.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcheu@chromium.org \
    --cc=mhocko@suse.com \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®