From: Ming Lei <ming.lei@redhat.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Michal Hocko <mhocko@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Hugh Dickins <hughd@google.com>, Minchan Kim <minchan@kernel.org>,
Rik van Riel <riel@redhat.com>,
Daniel Jordan <daniel.m.jordan@oracle.com>
Subject: Re: [PATCH -mm -V2] mm, swap: Fix THP swap out
Date: Mon, 24 Jun 2019 17:04:21 +0800 [thread overview]
Message-ID: <20190624090420.GD10941@ming.t460p> (raw)
In-Reply-To: <20190624075515.31040-1-ying.huang@intel.com>
On Mon, Jun 24, 2019 at 03:55:15PM +0800, Huang, Ying wrote:
> From: Huang Ying <ying.huang@intel.com>
>
> 0-Day test system reported some OOM regressions for several
> THP (Transparent Huge Page) swap test cases. These regressions are
> bisected to 6861428921b5 ("block: always define BIO_MAX_PAGES as
> 256"). In the commit, BIO_MAX_PAGES is set to 256 even when THP swap
> is enabled. So the bio_alloc(gfp_flags, 512) in get_swap_bio() may
> fail when swapping out THP. That causes the OOM.
>
> As in the patch description of 6861428921b5 ("block: always define
> BIO_MAX_PAGES as 256"), THP swap should use multi-page bvec to write
> THP to swap space. So the issue is fixed via doing that in
> get_swap_bio().
>
> BTW: I remember I have checked the THP swap code when
> 6861428921b5 ("block: always define BIO_MAX_PAGES as 256") was merged,
> and thought the THP swap code needn't to be changed. But apparently,
> I was wrong. I should have done this at that time.
>
> Fixes: 6861428921b5 ("block: always define BIO_MAX_PAGES as 256")
> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
>
> Changelogs:
>
> V2:
>
> - Replace __bio_add_page() with bio_add_page() per Ming's comments.
>
> ---
> mm/page_io.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_io.c b/mm/page_io.c
> index 2e8019d0e048..189415852077 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -29,10 +29,9 @@
> static struct bio *get_swap_bio(gfp_t gfp_flags,
> struct page *page, bio_end_io_t end_io)
> {
> - int i, nr = hpage_nr_pages(page);
> struct bio *bio;
>
> - bio = bio_alloc(gfp_flags, nr);
> + bio = bio_alloc(gfp_flags, 1);
> if (bio) {
> struct block_device *bdev;
>
> @@ -41,9 +40,7 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,
> bio->bi_iter.bi_sector <<= PAGE_SHIFT - 9;
> bio->bi_end_io = end_io;
>
> - for (i = 0; i < nr; i++)
> - bio_add_page(bio, page + i, PAGE_SIZE, 0);
> - VM_BUG_ON(bio->bi_iter.bi_size != PAGE_SIZE * nr);
> + bio_add_page(bio, page, PAGE_SIZE * hpage_nr_pages(page), 0);
> }
> return bio;
> }
> --
> 2.20.1
>
Looks fine:
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
prev parent reply other threads:[~2019-06-24 9:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 7:55 Huang, Ying
2019-06-24 9:04 ` Ming Lei [this message]
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=20190624090420.GD10941@ming.t460p \
--to=ming.lei@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=daniel.m.jordan@oracle.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=ying.huang@intel.com \
/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