All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>, Mel Gorman <mgorman@suse.de>,
	Vlastimil Babka <vbabka@suse.cz>,
	Christoph Lameter <cl@gentwo.org>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Steve Capper <steve.capper@linaro.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>,
	Jerome Marchand <jmarchan@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCHv3 03/24] mm: avoid PG_locked on tail pages
Date: Thu, 12 Feb 2015 14:55:58 -0500	[thread overview]
Message-ID: <54DD054E.7000605@redhat.com> (raw)
In-Reply-To: <1423757918-197669-4-git-send-email-kirill.shutemov@linux.intel.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/12/2015 11:18 AM, Kirill A. Shutemov wrote:
> With new refcounting pte entries can point to tail pages. It's
> doesn't make much sense to mark tail page locked -- we need to
> protect whole compound page.
> 
> This patch adjust helpers related to PG_locked to operate on head
> page.
> 
> Signed-off-by: Kirill A. Shutemov
> <kirill.shutemov@linux.intel.com> --- include/linux/page-flags.h |
> 3 ++- include/linux/pagemap.h    | 5 +++++ mm/filemap.c
> | 1 + mm/slub.c                  | 2 ++ 4 files changed, 10
> insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/page-flags.h
> b/include/linux/page-flags.h index 5ed7bdaf22d5..d471370f27e8
> 100644 --- a/include/linux/page-flags.h +++
> b/include/linux/page-flags.h @@ -207,7 +207,8 @@ static inline int
> __TestClearPage##uname(struct page *page) { return 0; }
> 
> struct page;	/* forward declaration */
> 
> -TESTPAGEFLAG(Locked, locked) +#define PageLocked(page)
> test_bit(PG_locked, &compound_head(page)->flags) + PAGEFLAG(Error,
> error) TESTCLEARFLAG(Error, error) PAGEFLAG(Referenced, referenced)
> TESTCLEARFLAG(Referenced, referenced) __SETPAGEFLAG(Referenced,
> referenced) diff --git a/include/linux/pagemap.h
> b/include/linux/pagemap.h index 4b3736f7065c..ad6da4e49555 100644 
> --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@
> -428,16 +428,19 @@ extern void unlock_page(struct page *page);
> 
> static inline void __set_page_locked(struct page *page) { +
> VM_BUG_ON_PAGE(PageTail(page), page); __set_bit(PG_locked,
> &page->flags); }
> 
> static inline void __clear_page_locked(struct page *page) { +
> VM_BUG_ON_PAGE(PageTail(page), page); __clear_bit(PG_locked,
> &page->flags); }
> 
> static inline int trylock_page(struct page *page) { +	page =
> compound_head(page); return
> (likely(!test_and_set_bit_lock(PG_locked, &page->flags))); }
> 
> @@ -490,6 +493,7 @@ extern int
> wait_on_page_bit_killable_timeout(struct page *page,
> 
> static inline int wait_on_page_locked_killable(struct page *page) 
> { +	page = compound_head(page); if (PageLocked(page)) return
> wait_on_page_bit_killable(page, PG_locked); return 0; @@ -510,6
> +514,7 @@ static inline void wake_up_page(struct page *page, int
> bit) */ static inline void wait_on_page_locked(struct page *page) 
> { +	page = compound_head(page); if (PageLocked(page)) 
> wait_on_page_bit(page, PG_locked); }

These are all atomic operations.

This may be a stupid question with the answer lurking somewhere
in the other patches, but how do you ensure you operate on the
right page lock during a THP collapse or split?



- -- 
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU3QVOAAoJEM553pKExN6DUtAH/2hjg6ab/9bArQ187YGssOoZ
yXqpeMgt0klHjqWxtVxZnzExbSfYIrrBKpg5kJJzqk2cQ/ZjMj0TbVnkgHhFEn3f
r6vh4wIljmmFjo+4RiYGEEJkQWNwFgX0XTEcJLw2VQp4xKL0wjhN1hC+SQBGiPL0
JefeCraxqAoq+viV65lvxWYJrXQ4Lm90z7dIa5fh8M5lG3P+Wy6cZXCeevV1Tvw7
iF20HuOTnGuNfClo7b5h/vCV6I6ViHEgThCCR3iBIdsh1L2bBoqMaNzDVD19tw7Y
m2I8Of/cc4eSadDJPkkfXxKD2w/qpbHxYXviN9dRq/qm7ApeySLN3GdW1K/xvAw=
=q6Zo
-----END PGP SIGNATURE-----

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

WARNING: multiple messages have this Message-ID (diff)
From: Rik van Riel <riel@redhat.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>, Mel Gorman <mgorman@suse.de>,
	Vlastimil Babka <vbabka@suse.cz>,
	Christoph Lameter <cl@gentwo.org>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Steve Capper <steve.capper@linaro.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>,
	Jerome Marchand <jmarchan@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCHv3 03/24] mm: avoid PG_locked on tail pages
Date: Thu, 12 Feb 2015 14:55:58 -0500	[thread overview]
Message-ID: <54DD054E.7000605@redhat.com> (raw)
In-Reply-To: <1423757918-197669-4-git-send-email-kirill.shutemov@linux.intel.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/12/2015 11:18 AM, Kirill A. Shutemov wrote:
> With new refcounting pte entries can point to tail pages. It's
> doesn't make much sense to mark tail page locked -- we need to
> protect whole compound page.
> 
> This patch adjust helpers related to PG_locked to operate on head
> page.
> 
> Signed-off-by: Kirill A. Shutemov
> <kirill.shutemov@linux.intel.com> --- include/linux/page-flags.h |
> 3 ++- include/linux/pagemap.h    | 5 +++++ mm/filemap.c
> | 1 + mm/slub.c                  | 2 ++ 4 files changed, 10
> insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/page-flags.h
> b/include/linux/page-flags.h index 5ed7bdaf22d5..d471370f27e8
> 100644 --- a/include/linux/page-flags.h +++
> b/include/linux/page-flags.h @@ -207,7 +207,8 @@ static inline int
> __TestClearPage##uname(struct page *page) { return 0; }
> 
> struct page;	/* forward declaration */
> 
> -TESTPAGEFLAG(Locked, locked) +#define PageLocked(page)
> test_bit(PG_locked, &compound_head(page)->flags) + PAGEFLAG(Error,
> error) TESTCLEARFLAG(Error, error) PAGEFLAG(Referenced, referenced)
> TESTCLEARFLAG(Referenced, referenced) __SETPAGEFLAG(Referenced,
> referenced) diff --git a/include/linux/pagemap.h
> b/include/linux/pagemap.h index 4b3736f7065c..ad6da4e49555 100644 
> --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@
> -428,16 +428,19 @@ extern void unlock_page(struct page *page);
> 
> static inline void __set_page_locked(struct page *page) { +
> VM_BUG_ON_PAGE(PageTail(page), page); __set_bit(PG_locked,
> &page->flags); }
> 
> static inline void __clear_page_locked(struct page *page) { +
> VM_BUG_ON_PAGE(PageTail(page), page); __clear_bit(PG_locked,
> &page->flags); }
> 
> static inline int trylock_page(struct page *page) { +	page =
> compound_head(page); return
> (likely(!test_and_set_bit_lock(PG_locked, &page->flags))); }
> 
> @@ -490,6 +493,7 @@ extern int
> wait_on_page_bit_killable_timeout(struct page *page,
> 
> static inline int wait_on_page_locked_killable(struct page *page) 
> { +	page = compound_head(page); if (PageLocked(page)) return
> wait_on_page_bit_killable(page, PG_locked); return 0; @@ -510,6
> +514,7 @@ static inline void wake_up_page(struct page *page, int
> bit) */ static inline void wait_on_page_locked(struct page *page) 
> { +	page = compound_head(page); if (PageLocked(page)) 
> wait_on_page_bit(page, PG_locked); }

These are all atomic operations.

This may be a stupid question with the answer lurking somewhere
in the other patches, but how do you ensure you operate on the
right page lock during a THP collapse or split?



- -- 
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU3QVOAAoJEM553pKExN6DUtAH/2hjg6ab/9bArQ187YGssOoZ
yXqpeMgt0klHjqWxtVxZnzExbSfYIrrBKpg5kJJzqk2cQ/ZjMj0TbVnkgHhFEn3f
r6vh4wIljmmFjo+4RiYGEEJkQWNwFgX0XTEcJLw2VQp4xKL0wjhN1hC+SQBGiPL0
JefeCraxqAoq+viV65lvxWYJrXQ4Lm90z7dIa5fh8M5lG3P+Wy6cZXCeevV1Tvw7
iF20HuOTnGuNfClo7b5h/vCV6I6ViHEgThCCR3iBIdsh1L2bBoqMaNzDVD19tw7Y
m2I8Of/cc4eSadDJPkkfXxKD2w/qpbHxYXviN9dRq/qm7ApeySLN3GdW1K/xvAw=
=q6Zo
-----END PGP SIGNATURE-----

  reply	other threads:[~2015-02-12 19:56 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 16:18 [PATCHv3 00/24] THP refcounting redesign Kirill A. Shutemov
2015-02-12 16:18 ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 01/24] thp: cluster split_huge_page* code together Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 02/24] mm: change PageAnon() and page_anon_vma() to work on tail pages Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 03/24] mm: avoid PG_locked " Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 19:55   ` Rik van Riel [this message]
2015-02-12 19:55     ` Rik van Riel
2015-02-12 20:10     ` Rik van Riel
2015-02-12 20:10       ` Rik van Riel
2015-03-03 13:21       ` Aneesh Kumar K.V
2015-03-03 13:21         ` Aneesh Kumar K.V
2015-03-03 13:35         ` Kirill A. Shutemov
2015-03-03 13:35           ` Kirill A. Shutemov
2015-03-03 15:21           ` Aneesh Kumar K.V
2015-03-03 15:21             ` Aneesh Kumar K.V
2015-02-12 16:18 ` [PATCHv3 04/24] rmap: add argument to charge compound page Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 21:10   ` Rik van Riel
2015-02-12 21:10     ` Rik van Riel
2015-02-16 15:20     ` Kirill A. Shutemov
2015-02-16 15:20       ` Kirill A. Shutemov
2015-02-20 17:39       ` Jerome Marchand
2015-02-23 16:21   ` Vlastimil Babka
2015-02-23 16:21     ` Vlastimil Babka
2015-03-04 11:52     ` Kirill A. Shutemov
2015-03-04 11:52       ` Kirill A. Shutemov
2015-03-04 12:09       ` Vlastimil Babka
2015-03-04 12:09         ` Vlastimil Babka
2015-03-04 13:26         ` Kirill A. Shutemov
2015-03-04 13:26           ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 05/24] mm, proc: adjust PSS calculation Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-20 17:31   ` Jerome Marchand
2015-02-23 13:52     ` Kirill A. Shutemov
2015-02-23 13:52       ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 06/24] mm: store mapcount for compound page separately Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 07/24] mm, thp: adjust conditions when we can reuse the page on WP fault Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 08/24] mm: adjust FOLL_SPLIT for new refcounting Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 09/24] thp, mlock: do not allow huge pages in mlocked area Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 10/24] khugepaged: ignore pmd tables with THP mapped with ptes Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 11/24] thp: rename split_huge_page_pmd() to split_huge_pmd() Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 12/24] thp: PMD splitting without splitting compound page Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 13/24] mm, vmstats: new THP splitting event Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 14/24] thp: implement new split_huge_page() Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 17:07   ` Sasha Levin
2015-02-12 17:07     ` Sasha Levin
2015-02-12 19:24     ` Sasha Levin
2015-02-12 19:24       ` Sasha Levin
2015-02-16 15:57       ` Kirill A. Shutemov
2015-02-16 15:57         ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 15/24] mm, thp: remove infrastructure for handling splitting PMDs Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 16/24] x86, " Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 17/24] futex, thp: remove special case for THP in get_futex_key Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 18/24] thp, mm: split_huge_page(): caller need to lock page Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 19/24] thp, mm: use migration entries to freeze page counts on split Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 20/24] mm, thp: remove compound_lock Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 21/24] thp: introduce deferred_split_huge_page() Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 22/24] memcg: adjust to support new THP refcounting Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 23/24] ksm: split huge pages on follow_page() Kirill A. Shutemov
2015-02-12 16:18   ` Kirill A. Shutemov
2015-02-12 16:18 ` [PATCHv3 24/24] thp: update documentation Kirill A. Shutemov
2015-02-12 16:18   ` 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=54DD054E.7000605@redhat.com \
    --to=riel@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cl@gentwo.org \
    --cc=dave.hansen@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jmarchan@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=steve.capper@linaro.org \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.