linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
To: willy@infradead.org
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>,
	linux-ext4@vger.kernel.org, gor@linux.ibm.com,
	agordeev@linux.ibm.com, linux-f2fs-devel@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-nilfs@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH 06/10] hugetlbfs: Convert remove_inode_hugepages() to use filemap_get_folios()
Date: Fri, 10 Jun 2022 20:35:30 +0200	[thread overview]
Message-ID: <20220610203530.7f84bbc0@thinkpad> (raw)
In-Reply-To: <20220610155205.3111213-1-sumanthk@linux.ibm.com>

On Fri, 10 Jun 2022 17:52:05 +0200
Sumanth Korikkar <sumanthk@linux.ibm.com> wrote:

[...]
> 
> * Bisected the crash to this commit.
> 
> To reproduce:
> * clone libhugetlbfs:
> * Execute, PATH=$PATH:"obj64/" LD_LIBRARY_PATH=../obj64/ alloc-instantiate-race shared
>  
> Crashes on both s390 and x86. 

FWIW, not really able to understand the code changes, so I added some
printks to track the state of inode->i_data.nrpages during
remove_inode_hugepages().

Before this commit, we enter with nrpages = 99, and leave with nrpages = 0.
With this commit we enter with nrpages = 99, and leave with nrpages = 84
(i.e. 99 - PAGEVEC_SIZE), resulting in the BUG later in fs/inode.c:612.

The difference seems to be that with this commit, the outer
while(filemap_get_folios) loop is only traversed once, while before
the corresponding while(pagevec_lookup_range) loop was repeated until
nrpages reached 0 (in steps of 15 == PAGEVEC_SIZE for the inner loop).

Both before and after the commit, the pagevec_count / folio_batch_count
for the inner loop starts with 15, but before the pagevec_lookup_range()
also increased &next in steps of 15, while now the filemap_get_folios()
moved &next from 0 to 270 in one step, while still only returning
15 as folio_batch_count for the inner loop. I assume the next index
of 270 is then too big to find any other folios, so it stops after the
first iteration, even though only 15 pages have been processed yet with
remove_huge_page(&folio->page).

I guess it is either wrong to return 15 as folio_batch_count (although
it seems that would be the maximum possible value), or it is wrong to
advance &next by 270 instead of 15.

Hope that makes any sense, and might be of help for debugging, to someone
more familiar with this code.

  reply	other threads:[~2022-06-10 18:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-05 19:38 [PATCH 00/10] Convert to filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-05 19:38 ` [PATCH 01/10] filemap: Add filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-08  8:00   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 02/10] buffer: Convert clean_bdev_aliases() to use filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-08  8:01   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 03/10] ext4: Convert mpage_release_unused_pages() " Matthew Wilcox (Oracle)
2022-06-08  8:02   ` Christoph Hellwig
2022-06-08 16:02     ` Matthew Wilcox
2022-06-09  3:55       ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 04/10] ext4: Convert mpage_map_and_submit_buffers() " Matthew Wilcox (Oracle)
2022-06-08  8:03   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 05/10] f2fs: Convert f2fs_invalidate_compress_pages() " Matthew Wilcox (Oracle)
2022-06-08  8:03   ` Christoph Hellwig
2022-06-15  8:14   ` [f2fs-dev] " Chao Yu
2022-06-05 19:38 ` [PATCH 06/10] hugetlbfs: Convert remove_inode_hugepages() " Matthew Wilcox (Oracle)
2022-06-08  8:04   ` Christoph Hellwig
2022-06-10 15:52   ` Sumanth Korikkar
2022-06-10 18:35     ` Gerald Schaefer [this message]
2022-06-10 21:17     ` Matthew Wilcox
2022-06-10 21:56       ` Mike Kravetz
2022-06-13  6:56       ` Sumanth Korikkar
2022-06-05 19:38 ` [PATCH 07/10] nilfs2: Convert nilfs_copy_back_pages() " Matthew Wilcox (Oracle)
2022-06-07 16:10   ` Ryusuke Konishi
2022-06-08  8:04   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 08/10] vmscan: Add check_move_unevictable_folios() Matthew Wilcox (Oracle)
2022-06-08  8:07   ` Christoph Hellwig
2022-06-08 16:32     ` Matthew Wilcox
2022-06-09  3:56       ` Christoph Hellwig
2022-06-08 15:33   ` [vmscan] bc9eb0d5ef: BUG:KASAN:stack-out-of-bounds_in_check_move_unevictable_pages kernel test robot
2022-06-05 19:38 ` [PATCH 09/10] shmem: Convert shmem_unlock_mapping() to use filemap_get_folios() Matthew Wilcox (Oracle)
2022-06-08  8:08   ` Christoph Hellwig
2022-06-05 19:38 ` [PATCH 10/10] filemap: Remove find_get_pages_range() and associated functions Matthew Wilcox (Oracle)
2022-06-08  8:08   ` Christoph Hellwig
2022-06-07 11:37 ` [PATCH 00/10] Convert to filemap_get_folios() Christian Brauner

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=20220610203530.7f84bbc0@thinkpad \
    --to=gerald.schaefer@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).