linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Matthew Wilcox <willy@infradead.org>
Cc: Huang Ying <ying.huang@intel.com>, linux-mm@kvack.org
Subject: Re: page cache: Store only head pages in i_pages
Date: Sat, 23 Mar 2019 22:52:49 -0400	[thread overview]
Message-ID: <897cfdda-7686-3794-571a-ecb8b9f6101f@lca.pw> (raw)
In-Reply-To: <20190324020614.GD10344@bombadil.infradead.org>



On 3/23/19 10:06 PM, Matthew Wilcox wrote:
> Thanks for testing.  Kirill suggests this would be a better fix:
> 
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 41858a3744b4..9718393ae45b 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -334,10 +334,12 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping,
>  
>  static inline struct page *find_subpage(struct page *page, pgoff_t offset)
>  {
> +	unsigned long index = page_index(page);
> +
>  	VM_BUG_ON_PAGE(PageTail(page), page);
> -	VM_BUG_ON_PAGE(page->index > offset, page);
> -	VM_BUG_ON_PAGE(page->index + compound_nr(page) <= offset, page);
> -	return page - page->index + offset;
> +	VM_BUG_ON_PAGE(index > offset, page);
> +	VM_BUG_ON_PAGE(index + compound_nr(page) <= offset, page);
> +	return page - index + offset;
>  }
>  
>  struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);

This is not even compiled.

If "s/compound_nr/compound_order/", it failed to boot here,

[   56.843236] Unpacking initramfs...
[   56.881979] page:ffff7fe022eb19c0 count:3 mapcount:0 mapping:38ff80080099c008
index:0x0
[   56.890007] ramfs_aops
[   56.890011] name:"lvm.conf"
[   56.892465] flags: 0x17fffffa400000c(uptodate|dirty)
[   56.900318] raw: 017fffffa400000c dead000000000100 dead000000000200
38ff80080099c008
[   56.908066] raw: 0000000000000000 0000000000000000 00000003ffffffff
7bff8008203bcc80
[   56.915812] page dumped because: VM_BUG_ON_PAGE(index + compound_order(page)
<= offset)
[   56.923818] page->mem_cgroup:7bff8008203bcc80
[   56.928180] page allocated via order 0, migratetype Unmovable, gfp_mask
0x100cc2(GFP_HIGHUSER)
[   56.936800]  prep_new_page+0x4e0/0x5e0
[   56.940556]  get_page_from_freelist+0x4cf4/0x50e0
[   56.945265]  __alloc_pages_nodemask+0x738/0x38b8
[   56.949888]  alloc_page_interleave+0x34/0x2f0
[   56.954249]  alloc_pages_current+0xc0/0x150
[   56.958439]  __page_cache_alloc+0x70/0x2f4
[   56.962541]  pagecache_get_page+0x5e4/0xaf0
[   56.966729]  grab_cache_page_write_begin+0x6c/0x98
[   56.971526]  simple_write_begin+0x40/0x308
[   56.975627]  generic_perform_write+0x1d4/0x4e0
[   56.980076]  __generic_file_write_iter+0x294/0x504
[   56.984872]  generic_file_write_iter+0x354/0x594
[   56.989496]  __vfs_write+0x72c/0x8a0
[   56.993076]  vfs_write+0x1ec/0x424
[   56.996481]  ksys_write+0xbc/0x190
[   56.999890]  xwrite+0x38/0x84
[   57.002869] ------------[ cut here ]------------
[   57.007478] kernel BUG at ./include/linux/pagemap.h:342!
[   57.012801] Internal error: Oops - BUG: 0 [#1] SMP
[   57.017584] Modules linked in:
[   57.020636] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc1-mm1+ #7
[   57.027239] Hardware name: HPE Apollo 70             /C01_APACHE_MB         ,
BIOS L50_5.13_1.0.6 07/10/2018
[   57.037057] pstate: 60400009 (nZCv daif +PAN -UAO)
[   57.041839] pc : find_get_entry+0x948/0x950
[   57.046013] lr : find_get_entry+0x940/0x950
[   57.050185] sp : 10ff80082600f420
[   57.053489] x29: 10ff80082600f4d0 x28: efff100000000000
[   57.058792] x27: ffff7fe022eb19c8 x26: 0000000000000010
[   57.064095] x25: 0000000000000035 x24: 0000000000000003
[   57.069397] x23: 00000000000000ff x22: 10ff80082600f460
[   57.074700] x21: ffff7fe022eb19c0 x20: 35ff800825f9a050
[   57.080002] x19: 0000000000000000 x18: 0000000000000000
[   57.085304] x17: 0000000000000000 x16: 000000000000000a
[   57.090606] x15: 35ff800825f9a0b8 x14: 0000000000000000
[   57.095908] x13: ffff800825f9a050 x12: 00000000ffffffff
[   57.101210] x11: 0000000000000003 x10: 00000000000000ff
[   57.106512] x9 : e071b95619aca700 x8 : e071b95619aca700
[   57.111814] x7 : 0000000000000000 x6 : ffff1000102d01f4
[   57.117116] x5 : 0000000000000000 x4 : 0000000000000080
[   57.122418] x3 : ffff1000102b84c8 x2 : 0000000000000000
[   57.127720] x1 : 0000000000000004 x0 : ffff100013316b10
[   57.133024] Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
[   57.139715] Call trace:
[   57.142153]  find_get_entry+0x948/0x950
[   57.145979]  pagecache_get_page+0x68/0xaf0
[   57.150066]  grab_cache_page_write_begin+0x6c/0x98
[   57.154847]  simple_write_begin+0x40/0x308
[   57.158934]  generic_perform_write+0x1d4/0x4e0
[   57.163368]  __generic_file_write_iter+0x294/0x504
[   57.168150]  generic_file_write_iter+0x354/0x594
[   57.172757]  __vfs_write+0x72c/0x8a0
[   57.176323]  vfs_write+0x1ec/0x424
[   57.179715]  ksys_write+0xbc/0x190
[   57.183107]  xwrite+0x38/0x84
[   57.186066]  do_copy+0x110/0x898
[   57.189284]  write_buffer+0x148/0x1cc
[   57.192937]  flush_buffer+0x94/0x240
[   57.196505]  __gunzip+0x738/0x8f0
[   57.199810]  gunzip+0x18/0x20
[   57.202768]  unpack_to_rootfs+0x358/0x968
[   57.206769]  populate_rootfs+0x120/0x198
[   57.210684]  do_one_initcall+0x544/0xd00
[   57.214597]  do_initcall_level+0x660/0x814
[   57.218684]  do_basic_setup+0x38/0x50
[   57.222337]  kernel_init_freeable+0x25c/0x444
[   57.226686]  kernel_init+0x1c/0x548
[   57.230165]  ret_from_fork+0x10/0x18
[   57.233733] Code: aa1503e0 94034d79 b0016fe0 912c4000 (d4210000)
[   57.240055] ---[ end trace d7c5c3c62a7fa743 ]---
[   57.244664] Kernel panic - not syncing: Fatal exception
[   57.249997] SMP: stopping secondary CPUs
[   57.254417] ---[ end Kernel panic - not syncing: Fatal exception ]---


  reply	other threads:[~2019-03-24  2:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1553285568.26196.24.camel@lca.pw>
2019-03-23  3:38 ` page cache: Store only head pages in i_pages Matthew Wilcox
2019-03-23 23:50   ` Qian Cai
2019-03-24  2:06     ` Matthew Wilcox
2019-03-24  2:52       ` Qian Cai [this message]
2019-03-24  3:04         ` Matthew Wilcox
2019-03-24 15:42           ` Qian Cai
2019-03-27 10:48           ` William Kucharski
2019-03-27 11:50             ` Matthew Wilcox
2019-03-29  1:43           ` Qian Cai
2019-03-29 19:59             ` Matthew Wilcox
2019-03-29 21:25               ` Qian Cai
2019-03-30  3:04                 ` Matthew Wilcox
2019-03-30 14:10                   ` Matthew Wilcox
2019-03-31  3:23                     ` Matthew Wilcox
2019-04-01  9:18                       ` Kirill A. Shutemov
2019-04-01  9:27                         ` Kirill A. Shutemov
2019-04-04 13:10                           ` Qian Cai
2019-04-04 13:45                             ` Kirill A. Shutemov
2019-04-04 21:28                               ` Qian Cai
2019-04-05 13:37                                 ` Kirill A. Shutemov
2019-04-05 13:51                                   ` Matthew Wilcox

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=897cfdda-7686-3794-571a-ecb8b9f6101f@lca.pw \
    --to=cai@lca.pw \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    --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).