linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>,
	huang ying <huang.ying.caritas@gmail.com>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: kernel BUG at mm/swap_state.c:170!
Date: Thu, 25 Jul 2019 04:44:08 -0700	[thread overview]
Message-ID: <20190725114408.GV363@bombadil.infradead.org> (raw)
In-Reply-To: <87zhl59w2t.fsf@yhuang-dev.intel.com>

On Tue, Jul 23, 2019 at 01:08:42PM +0800, Huang, Ying wrote:
> @@ -2489,6 +2491,14 @@ static void __split_huge_page(struct page *page, struct list_head *list,
>  	/* complete memcg works before add pages to LRU */
>  	mem_cgroup_split_huge_fixup(head);
>  
> +	if (PageAnon(head) && PageSwapCache(head)) {
> +		swp_entry_t entry = { .val = page_private(head) };
> +
> +		offset = swp_offset(entry);
> +		swap_cache = swap_address_space(entry);
> +		xa_lock(&swap_cache->i_pages);
> +	}
> +
>  	for (i = HPAGE_PMD_NR - 1; i >= 1; i--) {
>  		__split_huge_page_tail(head, i, lruvec, list);
>  		/* Some pages can be beyond i_size: drop them from page cache */
> @@ -2501,6 +2511,9 @@ static void __split_huge_page(struct page *page, struct list_head *list,
>  		} else if (!PageAnon(page)) {
>  			__xa_store(&head->mapping->i_pages, head[i].index,
>  					head + i, 0);
> +		} else if (swap_cache) {
> +			__xa_store(&swap_cache->i_pages, offset + i,
> +				   head + i, 0);

I tried something along these lines (though I think I messed up the offset
calculation which is why it wasn't working for me).  My other concern
was with the case where SWAPFILE_CLUSTER was less than HPAGE_PMD_NR.
Don't we need to drop the lock and look up a new swap_cache if offset >=
SWAPFILE_CLUSTER?


  parent reply	other threads:[~2019-07-25 11:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  4:05 kernel BUG at mm/swap_state.c:170! Mikhail Gavrilov
2019-05-29 17:32 ` Mikhail Gavrilov
2019-05-29 18:09   ` Michal Hocko
2019-05-29 19:28     ` Mikhail Gavrilov
2019-06-05 20:07     ` Mikhail Gavrilov
2019-06-11  3:59     ` Mikhail Gavrilov
2019-06-16 10:12       ` Mikhail Gavrilov
2019-06-17 12:17         ` Vlastimil Babka
2019-06-17 20:09           ` Mikhail Gavrilov
2019-06-30 21:15           ` Mikhail Gavrilov
2019-07-05 15:19             ` Mikhail Gavrilov
2019-07-05 23:03               ` Jan Kara
2019-07-06  2:39                 ` Linus Torvalds
2019-06-17 12:47   ` Vlastimil Babka
2019-07-22  1:37 ` huang ying
2019-07-22  7:31   ` Mikhail Gavrilov
2019-07-22  7:52     ` Huang, Ying
2019-07-22  7:56       ` Mikhail Gavrilov
2019-07-23  5:08         ` Huang, Ying
2019-07-25  6:17           ` Mikhail Gavrilov
2019-07-25  7:14             ` Huang, Ying
2019-07-25 11:44           ` Matthew Wilcox [this message]
2019-07-26  3:20             ` Huang, Ying

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=20190725114408.GV363@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=huang.ying.caritas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mikhail.v.gavrilov@gmail.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;
as well as URLs for NNTP newsgroup(s).