From: Geliang Tang <geliangtang@163.com>
To: Hugh Dickins <hughd@google.com>
Cc: Geliang Tang <geliangtang@163.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] shmem: use list_for_each_entry_safe in shmem_unuse
Date: Thu, 3 Dec 2015 22:22:07 +0800 [thread overview]
Message-ID: <73d897527151da752a219a6c38b2c261cb5b74fe.1449152443.git.geliangtang@163.com> (raw)
Simplify the code with list_for_each_entry_safe().
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
mm/shmem.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 9b05111..816685f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -793,8 +793,7 @@ static int shmem_unuse_inode(struct shmem_inode_info *info,
*/
int shmem_unuse(swp_entry_t swap, struct page *page)
{
- struct list_head *this, *next;
- struct shmem_inode_info *info;
+ struct shmem_inode_info *info, *next;
struct mem_cgroup *memcg;
int error = 0;
@@ -818,8 +817,7 @@ int shmem_unuse(swp_entry_t swap, struct page *page)
error = -EAGAIN;
mutex_lock(&shmem_swaplist_mutex);
- list_for_each_safe(this, next, &shmem_swaplist) {
- info = list_entry(this, struct shmem_inode_info, swaplist);
+ list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) {
if (info->swapped)
error = shmem_unuse_inode(info, swap, &page);
else
--
2.5.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
reply other threads:[~2015-12-03 14:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=73d897527151da752a219a6c38b2c261cb5b74fe.1449152443.git.geliangtang@163.com \
--to=geliangtang@163.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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