From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH 1/3] page-flags: do not corrupt caller 'page' in PF_NO_TAIL
Date: Fri, 2 Oct 2015 08:40:14 +0300 [thread overview]
Message-ID: <1443764416-129688-2-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1443764416-129688-1-git-send-email-kirill.shutemov@linux.intel.com>
Andrew noticed that PF_NO_TAIL() modifies caller's 'page'. This doesn't
trigger any bad results, because all users are inline functions which
doesn't use the variable beyond the point. But still not good.
The patch changes PF_NO_TAIL() to always return head page, regardless
'enforce'. This makes operations of page flags with PF_NO_TAIL more
symmetrical: modifications and checks goes to head page. It gives
better chance to recover in case of bug for non-DEBUG_VM kernel.
DEBUG_VM kernel will still trigger VM_BUG_ON() on modifications to tail
pages.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
include/linux/page-flags.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 2a2391c21558..465ca42af633 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -139,9 +139,7 @@ enum pageflags {
#define PF_NO_TAIL(page, enforce) ({ \
if (enforce) \
VM_BUG_ON_PAGE(PageTail(page), page); \
- else \
- page = compound_head(page); \
- page;})
+ compound_head(page);})
#define PF_NO_COMPOUND(page, enforce) ({ \
if (enforce) \
VM_BUG_ON_PAGE(PageCompound(page), page); \
--
2.5.1
--
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>
next prev parent reply other threads:[~2015-10-02 5:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 5:40 [PATCH 0/3] page-flags updates Kirill A. Shutemov
2015-10-02 5:40 ` Kirill A. Shutemov [this message]
2015-10-02 5:40 ` [PATCH 2/3] page-flags: add documentation for policies Kirill A. Shutemov
2015-10-02 5:40 ` [PATCH 3/3] page-flags: hide PF_* validation check under separate config option Kirill A. Shutemov
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=1443764416-129688-2-git-send-email-kirill.shutemov@linux.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=akpm@linux-foundation.org \
--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