incoming
Subsystems (10)
+ mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove __ARCH_HAS_5LEVEL_HACK and include/asm-generic/5level-fixup.h has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm: remove __ARCH_HAS_5LEVEL_HACK and include/asm-generic/5level-fixup.h
has been added to the -mm tree. Its filename is
mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Mike Rapoport <[email protected]>
Subject: mm: remove __ARCH_HAS_5LEVEL_HACK and include/asm-generic/5level-fixup.h
There are no architectures that use include/asm-generic/5level-fixup.h therefore it can be removed along with __ARCH_HAS_5LEVEL_HACK define and the code it surrounds
---
include/asm-generic/5level-fixup.h | 58 --------------------------- include/linux/mm.h | 6 -- mm/kasan/init.c | 11 ----- mm/memory.c | 8 --- 4 files changed, 83 deletions(-)
include/asm-generic/5level-fixup.h deleted +0 -58
@@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _5LEVEL_FIXUP_H -#define _5LEVEL_FIXUP_H - -#define __ARCH_HAS_5LEVEL_HACK -#define __PAGETABLE_P4D_FOLDED 1 - -#define P4D_SHIFT PGDIR_SHIFT -#define P4D_SIZE PGDIR_SIZE -#define P4D_MASK PGDIR_MASK -#define MAX_PTRS_PER_P4D 1 -#define PTRS_PER_P4D 1 - -#define p4d_t pgd_t - -#define pud_alloc (mm, p4d, address) \ - ((unlikely(pgd_none(*(p4d))) && __pud_alloc(mm, p4d, address)) ? \ - NULL : pud_offset(p4d, address)) - -#define p4d_alloc (mm, pgd, address) (pgd) -#define p4d_offset (pgd, start) (pgd) - -#ifndef __ASSEMBLY__ -static inline int p4d_none (p4d_t p4d) -{ -return 0 ; -} - -static inline int p4d_bad (p4d_t p4d) -{ -return 0 ; -} - -static inline int p4d_present (p4d_t p4d) -{ -return 1 ; -} -#endif - -#define p4d_ERROR (p4d) do { } while (0) -#define p4d_clear (p4d) pgd_clear(p4d) -#define p4d_val (p4d) pgd_val(p4d) -#define p4d_populate (mm, p4d, pud) pgd_populate(mm, p4d, pud) -#define p4d_populate_safe (mm, p4d, pud) pgd_populate(mm, p4d, pud) -#define p4d_page (p4d) pgd_page(p4d) -#define p4d_page_vaddr (p4d) pgd_page_vaddr(p4d) - -#define __p4d (x) __pgd(x) -#define set_p4d (p4dp, p4d) set_pgd(p4dp, p4d) - -#undef p4d_free_tlb -#define p4d_free_tlb (tlb, x, addr) do { } while (0) -#define p4d_free (mm, x) do { } while (0) - -#undef p4d_addr_end -#define p4d_addr_end (addr, end) (end) - -#endif
include/linux/mm.h renamed from include/linux/mm.h~mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph +0 -6
@@ -2060,11 +2060,6 @@ int __pte_alloc_kernel(pmd_t *pmd);#if defined(CONFIG_MMU ) -/* - * The following ifdef needed to get the 5level-fixup.h header to work. - * Remove it when 5level-fixup.h has been removed. - */ -#ifndef __ARCH_HAS_5LEVEL_HACKstatic inline p4d_t *p4d_alloc (struct mm_struct *mm,pgd_t *pgd,unsigned long address) {
@@ -2078,7 +2073,6 @@ static inline pud_t *pud_alloc(struct mmreturn (unlikely (p4d_none (*p4d)) &&__pud_alloc (mm, p4d, address)) ?NULL :pud_offset (p4d, address); } -#endif /* !__ARCH_HAS_5LEVEL_HACK */ static inline pmd_t *pmd_alloc (struct mm_struct *mm,pud_t *pud,unsigned long address) {
mm/kasan/init.c renamed from mm/kasan/init.c~mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph +0 -11
@@ -250,20 +250,9 @@ int __ref kasan_populate_early_shadow(co* 3,2 - level page tables where we don't have * puds,pmds, so pgd_populate(), pud_populate() * is noops. -* -* The ifndef is required to avoid build breakage. -* -* With 5level-fixup.h, pgd_populate() is not nop and -* we reference kasan_early_shadow_p4d. It's not defined -* unless 5-level paging enabled. -* -* The ifndef can be dropped once all KASAN-enabled -* architectures will switch to pgtable-nop4d.h. */ -#ifndef __ARCH_HAS_5LEVEL_HACKpgd_populate (&init_mm, pgd,lm_alias (kasan_early_shadow_p4d)); -#endif p4d =p4d_offset (pgd, addr);p4d_populate (&init_mm, p4d,lm_alias (kasan_early_shadow_pud));
mm/memory.c renamed from mm/memory.c~mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph +0 -8
@@ -4434,19 +4434,11 @@ int __pud_alloc(struct mm_struct *mm, p4smp_wmb ();/* See comment in __pte_alloc */ spin_lock (&mm->page_table_lock); -#ifndef __ARCH_HAS_5LEVEL_HACKif (!p4d_present (*p4d)) {mm_inc_nr_puds (mm);p4d_populate (mm, p4d, new); }else /* Another has populated it */ pud_free (mm, new); -#else -if (!pgd_present (*p4d)) { -mm_inc_nr_puds (mm); -pgd_populate (mm, p4d, new); - }else /* Another has populated it */ -pud_free (mm, new); -#endif /* __ARCH_HAS_5LEVEL_HACK */ spin_unlock (&mm->page_table_lock);return 0 ; }
_
Patches currently in -mm which might be from [email protected] are
h8300-remove-usage-of-__arch_use_5level_hack.patch arm-add-support-for-folded-p4d-page-tables.patch arm64-add-support-for-folded-p4d-page-tables.patch hexagon-remove-__arch_use_5level_hack.patch ia64-add-support-for-folded-p4d-page-tables.patch nios2-add-support-for-folded-p4d-page-tables.patch openrisc-add-support-for-folded-p4d-page-tables.patch powerpc-add-support-for-folded-p4d-page-tables.patch sh-drop-__pxd_offset-macros-that-duplicate-pxd_index-ones.patch sh-add-support-for-folded-p4d-page-tables.patch unicore32-remove-__arch_use_5level_hack.patch asm-generic-remove-pgtable-nop4d-hackh.patch mm-remove-__arch_has_5level_hack-and-include-asm-generic-5level-fixuph.patch mm-memblock-replace-dereferences-of-memblock_regionnid-with-api-calls.patch mm-make-early_pfn_to_nid-and-related-defintions-close-to-each-other.patch mm-remove-config_have_memblock_node_map-option.patch mm-free_area_init-use-maximal-zone-pfns-rather-than-zone-sizes.patch mm-use-free_area_init-instead-of-free_area_init_nodes.patch alpha-simplify-detection-of-memory-zone-boundaries.patch arm-simplify-detection-of-memory-zone-boundaries.patch arm64-simplify-detection-of-memory-zone-boundaries-for-uma-configs.patch csky-simplify-detection-of-memory-zone-boundaries.patch m68k-mm-simplify-detection-of-memory-zone-boundaries.patch parisc-simplify-detection-of-memory-zone-boundaries.patch sparc32-simplify-detection-of-memory-zone-boundaries.patch unicore32-simplify-detection-of-memory-zone-boundaries.patch xtensa-simplify-detection-of-memory-zone-boundaries.patch mm-remove-early_pfn_in_nid-and-config_nodes_span_other_nodes.patch mm-free_area_init-allow-defining-max_zone_pfn-in-descending-order.patch mm-rename-free_area_init_node-to-free_area_init_memoryless_node.patch mm-clean-up-free_area_init_node-and-its-helpers.patch mm-simplify-find_min_pfn_with_active_regions.patch docs-vm-update-memory-models-documentation.patch
+ mm-move-readahead-prototypes-from-mmh.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: move readahead prototypes from mm.h has been added to the -mm tree. Its filename is mm-move-readahead-prototypes-from-mmh.patch
The patch titled
Subject: mm: move readahead prototypes from mm.h
has been added to the -mm tree. Its filename is
mm-move-readahead-prototypes-from-mmh.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-move-readahead-prototypes-from-mmh.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-move-readahead-prototypes-from-mmh.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: move readahead prototypes from mm.h
Patch series "Change readahead API", v11.
This series adds a readahead address_space operation to replace the readpages operation. The key difference is that pages are added to the page cache as they are allocated (and then looked up by the filesystem) instead of passing them on a list to the readpages operation and having the filesystem add them to the page cache. It's a net reduction in code for each implementation, more efficient than walking a list, and solves the direct-write vs buffered-read problem reported by yu kuai at
http://lkml.kernel.org/r/[email protected]
The only unconverted filesystems are those which use fscache. Their conversion is pending Dave Howells' rewrite which will make the conversion substantially easier. This should be completed by the end of the year.
I want to thank the reviewers/testers; Dave Chinner, John Hubbard, Eric Biggers, Johannes Thumshirn, Dave Sterba, Zi Yan, Christoph Hellwig and Miklos Szeredi have done a marvellous job of providing constructive criticism.
These patches pass an xfstests run on ext4, xfs & btrfs with no regressions that I can tell (some of the tests seem a little flaky before and remain flaky afterwards).
This patch (of 25):
The readahead code is part of the page cache so should be found in the pagemap.h file. force_page_cache_readahead is only used within mm, so move it to mm/internal.h instead. Remove the parameter names where they add no value, and rename the ones which were actively misleading.
---
block/blk-core.c | 1 + include/linux/mm.h | 19 ------------------- include/linux/pagemap.h | 8 ++++++++ mm/fadvise.c | 2 ++ mm/internal.h | 2 ++ 5 files changed, 13 insertions(+), 19 deletions(-)
block/blk-core.c renamed from block/blk-core.c~mm-move-readahead-prototypes-from-mmh +1 -0
@@ -20,6 +20,7 @@#include <linux/blk-mq.h> #include <linux/highmem.h> #include <linux/mm.h> +#include <linux/pagemap.h> #include <linux/kernel_stat.h> #include <linux/string.h> #include <linux/init.h>
include/linux/mm.h renamed from include/linux/mm.h~mm-move-readahead-prototypes-from-mmh +0 -19
@@ -2601,25 +2601,6 @@ extern vm_fault_t filemap_page_mkwrite(sint __must_check write_one_page (struct page *page);void task_dirty_inc (struct task_struct *tsk); -/* readahead.c */ -#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE) - -int force_page_cache_readahead (struct address_space *mapping,struct file *filp, -pgoff_t offset,unsigned long nr_to_read); - -void page_cache_sync_readahead (struct address_space *mapping, -struct file_ra_state *ra, -struct file *filp, -pgoff_t offset, -unsigned long size); - -void page_cache_async_readahead (struct address_space *mapping, -struct file_ra_state *ra, -struct file *filp, -struct page *pg, -pgoff_t offset, -unsigned long size); -extern unsigned long stack_guard_gap;/* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ extern int expand_stack (struct vm_area_struct *vma,unsigned long address);
include/linux/pagemap.h renamed from include/linux/pagemap.h~mm-move-readahead-prototypes-from-mmh +8 -0
@@ -615,6 +615,14 @@ int replace_page_cache_page(struct pagevoid delete_from_page_cache_batch (struct address_space *mapping,struct pagevec *pvec); +#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE) + +void page_cache_sync_readahead (struct address_space *,struct file_ra_state *, +struct file *,pgoff_t index,unsigned long req_count); +void page_cache_async_readahead (struct address_space *,struct file_ra_state *, +struct file *,struct page *,pgoff_t index, +unsigned long req_count); +/* * Like add_to_page_cache_locked, but used to add newly allocated pages: * the page is new, so we can just run __SetPageLocked() against it.
mm/fadvise.c renamed from mm/fadvise.c~mm-move-readahead-prototypes-from-mmh +2 -0
@@ -22,6 +22,8 @@#include <asm/unistd.h> +#include "internal.h" +/* * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could * deactivate the pages and clear PG_Referenced.
mm/internal.h renamed from mm/internal.h~mm-move-readahead-prototypes-from-mmh +2 -0
@@ -49,6 +49,8 @@ void unmap_page_range(struct mmu_gather unsigned long addr, unsigned long end, struct zap_details *details); +int force_page_cache_readahead (struct address_space *,struct file *, +pgoff_t index,unsigned long nr_to_read);extern unsigned int __do_page_cache_readahead (struct address_space *mapping,struct file *filp,pgoff_t offset,unsigned long nr_to_read,unsigned long lookahead_size);
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-return-void-from-various-readahead-functions.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: return void from various readahead functions has been added to the -mm tree. Its filename is mm-return-void-from-various-readahead-functions.patch
The patch titled
Subject: mm: return void from various readahead functions
has been added to the -mm tree. Its filename is
mm-return-void-from-various-readahead-functions.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-return-void-from-various-readahead-functions.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-return-void-from-various-readahead-functions.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: return void from various readahead functions
ondemand_readahead has two callers, neither of which use the return value. That means that both ra_submit and __do_page_cache_readahead() can return void, and we don't need to worry that a present page in the readahead window causes us to return a smaller nr_pages than we ought to have.
Similarly, no caller uses the return value fromforce_page_cache_readahead().
---
mm/fadvise.c | 4 ---- mm/internal.h | 12 ++++++------ mm/readahead.c | 31 +++++++++++++------------------ 3 files changed, 19 insertions(+), 28 deletions(-)
mm/fadvise.c renamed from mm/fadvise.c~mm-return-void-from-various-readahead-functions +0 -4
@@ -104,10 +104,6 @@ int generic_fadvise(struct file *file, lif (!nrpages) nrpages = ~0UL ; -/* -* Ignore return value because fadvise() shall return -* success even if filesystem can't retrieve a hint, -*/ force_page_cache_readahead (mapping, file, start_index, nrpages);break ;case POSIX_FADV_NOREUSE :
mm/internal.h renamed from mm/internal.h~mm-return-void-from-various-readahead-functions +6 -6
@@ -49,20 +49,20 @@ void unmap_page_range(struct mmu_gather unsigned long addr, unsigned long end, struct zap_details *details); -int force_page_cache_readahead (struct address_space *,struct file *, +void force_page_cache_readahead (struct address_space *,struct file *,pgoff_t index,unsigned long nr_to_read); -extern unsigned int __do_page_cache_readahead (struct address_space *mapping, -struct file *filp,pgoff_t offset,unsigned long nr_to_read, +void __do_page_cache_readahead (struct address_space *,struct file *, +pgoff_t index,unsigned long nr_to_read,unsigned long lookahead_size);/* * Submit IO for the read-ahead request in file_ra_state. */ -static inline unsigned long ra_submit (struct file_ra_state *ra, +static inline void ra_submit (struct file_ra_state *ra,struct address_space *mapping,struct file *filp) { -return __do_page_cache_readahead (mapping, filp, - ra->start, ra->size, ra->async_size); +__do_page_cache_readahead (mapping, filp, + ra->start, ra->size, ra->async_size); }/**
mm/readahead.c renamed from mm/readahead.c~mm-return-void-from-various-readahead-functions +13 -18
@@ -149,10 +149,8 @@ out:* the pages first, then submits them for I/O. This avoids the very bad * behaviour which would occur if page allocations are causing VM writeback. * We really don't want to intermingle reads and writes like that. -* -* Returns the number of pages requested, or the maximum amount of I/O allowed. */ -unsigned int __do_page_cache_readahead (struct address_space *mapping, +void __do_page_cache_readahead (struct address_space *mapping,struct file *filp,pgoff_t offset,unsigned long nr_to_read,unsigned long lookahead_size) {
@@ -166,7 +164,7 @@ unsigned int __do_page_cache_readahead(sgfp_t gfp_mask =readahead_gfp_mask (mapping);if (isize ==0 ) - goto out; +return ; end_index = ((isize -1 ) >>PAGE_SHIFT );
@@ -211,23 +209,21 @@ unsigned int __do_page_cache_readahead(sif (nr_pages)read_pages (mapping, filp, &page_pool, nr_pages, gfp_mask);BUG_ON (!list_empty (&page_pool)); -out: -return nr_pages; }/* * Chunk the readahead into 2 megabyte units, so that we don't pin too much * memory at once. */ -int force_page_cache_readahead (struct address_space *mapping,struct file *filp, -pgoff_t offset,unsigned long nr_to_read) +void force_page_cache_readahead (struct address_space *mapping, +struct file *filp,pgoff_t offset,unsigned long nr_to_read) {struct backing_dev_info *bdi =inode_to_bdi (mapping->host);struct file_ra_state *ra = &filp->f_ra;unsigned long max_pages;if (unlikely (!mapping->a_ops->readpage && !mapping->a_ops->readpages)) -return -EINVAL ; +return ;/* * If the request exceeds the readahead window, allow the read to
@@ -245,7 +241,6 @@ int force_page_cache_readahead(struct ad offset += this_chunk; nr_to_read -= this_chunk; } -return 0 ; }/*
@@ -378,11 +373,10 @@ static int try_context_readahead(struct/* * A minimal readahead algorithm for trivial sequential/random reads. */ -static unsigned long -ondemand_readahead (struct address_space *mapping, -struct file_ra_state *ra,struct file *filp, -bool hit_readahead_marker,pgoff_t offset, -unsigned long req_size) +static void ondemand_readahead (struct address_space *mapping, +struct file_ra_state *ra,struct file *filp, +bool hit_readahead_marker,pgoff_t offset, +unsigned long req_size) {struct backing_dev_info *bdi =inode_to_bdi (mapping->host);unsigned long max_pages = ra->ra_pages;
@@ -428,7 +422,7 @@ ondemand_readahead(struct address_spacercu_read_unlock ();if (!start || start - offset > max_pages) -return 0 ; +return ; ra->start = start; ra->size = start - offset;/* old async_size */
@@ -464,7 +458,8 @@ ondemand_readahead(struct address_space* standalone, small random read * Read as is, and do not pollute the readahead state. */ -return __do_page_cache_readahead (mapping, filp, offset, req_size,0 ); +__do_page_cache_readahead (mapping, filp, offset, req_size,0 ); +return ; initial_readahead: ra->start = offset;
@@ -489,7 +484,7 @@ readit: } } -return ra_submit (ra, mapping, filp); +ra_submit (ra, mapping, filp); }/**
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-ignore-return-value-of-readpages.patch added to -mm tree
In reply to Andrew MortonThe patch titled
The patch titled
Subject: mm: ignore return value of ->readpages
has been added to the -mm tree. Its filename is
mm-ignore-return-value-of-readpages.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-ignore-return-value-of-readpages.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-ignore-return-value-of-readpages.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: ignore return value of ->readpages
We used to assign the return value to a variable, which we then ignored. Remove the pretence of caring.
---
mm/readahead.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-ignore-return-value-of-readpages +2 -6
@@ -113,17 +113,16 @@ int read_cache_pages(struct address_spacEXPORT_SYMBOL (read_cache_pages); -static int read_pages (struct address_space *mapping,struct file *filp, +static void read_pages (struct address_space *mapping,struct file *filp,struct list_head *pages,unsigned int nr_pages,gfp_t gfp) {struct blk_plug plug;unsigned page_idx; -int ret;blk_start_plug (&plug);if (mapping->a_ops->readpages) { - ret = mapping->a_ops->readpages (filp, mapping, pages, nr_pages); + mapping->a_ops->readpages (filp, mapping, pages, nr_pages);/* Clean up the remaining pages */ put_pages_list (pages); goto out;
@@ -136,12 +135,9 @@ static int read_pages(struct address_spa mapping->a_ops->readpage (filp, page);put_page (page); } - ret =0 ; out:blk_finish_plug (&plug); - -return ret; }/*
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-move-readahead-nr_pages-check-into-read_pages.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: move readahead nr_pages check into read_pages has been added to the -mm tree. Its filename is mm-move-readahead-nr_pages-check-into-read_pages.patch
The patch titled
Subject: mm: move readahead nr_pages check into read_pages
has been added to the -mm tree. Its filename is
mm-move-readahead-nr_pages-check-into-read_pages.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-move-readahead-nr_pages-check-into-read_pages.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-move-readahead-nr_pages-check-into-read_pages.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: move readahead nr_pages check into read_pages
Simplify the callers by moving the check for nr_pages and the BUG_ON into read_pages().
---
mm/readahead.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-move-readahead-nr_pages-check-into-read_pages +7 -5
@@ -119,6 +119,9 @@ static void read_pages(struct address_spstruct blk_plug plug;unsigned page_idx; +if (!nr_pages) +return ; +blk_start_plug (&plug);if (mapping->a_ops->readpages) {
@@ -138,6 +141,8 @@ static void read_pages(struct address_sp out:blk_finish_plug (&plug); + +BUG_ON (!list_empty (pages)); }/*
@@ -180,8 +185,7 @@ void __do_page_cache_readahead(struct ad* contiguous pages before continuing with the next * batch. */ -if (nr_pages) -read_pages (mapping, filp, &page_pool, nr_pages, +read_pages (mapping, filp, &page_pool, nr_pages, gfp_mask); nr_pages =0 ;continue ;
@@ -202,9 +206,7 @@ void __do_page_cache_readahead(struct ad* uptodate then the caller will launch readpage again, and * will then handle the error. */ -if (nr_pages) -read_pages (mapping, filp, &page_pool, nr_pages, gfp_mask); -BUG_ON (!list_empty (&page_pool)); +read_pages (mapping, filp, &page_pool, nr_pages, gfp_mask); }/*
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-add-new-readahead_control-api.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: add new readahead_control API has been added to the -mm tree. Its filename is mm-add-new-readahead_control-api.patch
The patch titled
Subject: mm: add new readahead_control API
has been added to the -mm tree. Its filename is
mm-add-new-readahead_control-api.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-add-new-readahead_control-api.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-add-new-readahead_control-api.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: add new readahead_control API
Filesystems which implement the upcoming ->readahead method will get their pages by calling readahead_page() or readahead_page_batch(). These functions support large pages, even though none of the filesystems to be converted do yet.
---
include/linux/pagemap.h | 140 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+)
include/linux/pagemap.h renamed from include/linux/pagemap.h~mm-add-new-readahead_control-api +140 -0
@@ -639,6 +639,146 @@ static inline int add_to_page_cache(strureturn error; } +/** +* struct readahead_control - Describes a readahead request. +* +* A readahead request is for consecutive pages. Filesystems which +* implement the ->readahead method should call readahead_page() or +* readahead_page_batch() in a loop and attempt to start I/O against +* each page in the request. +* +* Most of the fields in this struct are private and should be accessed +* by the functions below. +* +* @file: The file, used primarily by network filesystems for authentication. +* May be NULL if invoked internally by the filesystem. +* @mapping: Readahead this filesystem object. +*/ +struct readahead_control { +struct file *file; +struct address_space *mapping; +/* private: use the readahead_* accessors instead */ +pgoff_t _index; +unsigned int _nr_pages; +unsigned int _batch_count; +}; + +/** +* readahead_page - Get the next page to read. +* @rac: The current readahead request. +* +* Context: The page is locked and has an elevated refcount. The caller +* should decreases the refcount once the page has been submitted for I/O +* and unlock the page once all I/O to that page has completed. +* Return: A pointer to the next page, or %NULL if we are done. +*/ +static inline struct page *readahead_page (struct readahead_control *rac) +{ +struct page *page; + +BUG_ON (rac->_batch_count > rac->_nr_pages); + rac->_nr_pages -= rac->_batch_count; + rac->_index += rac->_batch_count; + +if (!rac->_nr_pages) { + rac->_batch_count =0 ; +return NULL ; + } + + page =xa_load (&rac->mapping->i_pages, rac->_index); +VM_BUG_ON_PAGE (!PageLocked (page), page); + rac->_batch_count =hpage_nr_pages (page); + +return page; +} + +static inline unsigned int __readahead_batch (struct readahead_control *rac, +struct page **array,unsigned int array_sz) +{ +unsigned int i =0 ; +XA_STATE (xas, &rac->mapping->i_pages,0 ); +struct page *page; + +BUG_ON (rac->_batch_count > rac->_nr_pages); + rac->_nr_pages -= rac->_batch_count; + rac->_index += rac->_batch_count; + rac->_batch_count =0 ; + +xas_set (&xas, rac->_index); +rcu_read_lock (); +xas_for_each (&xas, page, rac->_index + rac->_nr_pages -1 ) { +VM_BUG_ON_PAGE (!PageLocked (page), page); +VM_BUG_ON_PAGE (PageTail (page), page); + array[i++] = page; + rac->_batch_count +=hpage_nr_pages (page); + +/* +* The page cache isn't using multi-index entries yet, +* so the xas cursor needs to be manually moved to the +* next index. This can be removed once the page cache +* is converted. +*/ +if (PageHead (page)) +xas_set (&xas, rac->_index + rac->_batch_count); + +if (i == array_sz) +break ; + } +rcu_read_unlock (); + +return i; +} + +/** +* readahead_page_batch - Get a batch of pages to read. +* @rac: The current readahead request. +* @array: An array of pointers to struct page. +* +* Context: The pages are locked and have an elevated refcount. The caller +* should decreases the refcount once the page has been submitted for I/O +* and unlock the page once all I/O to that page has completed. +* Return: The number of pages placed in the array. 0 indicates the request +* is complete. +*/ +#define readahead_page_batch (rac, array) \ + __readahead_batch(rac, array, ARRAY_SIZE(array)) + +/** +* readahead_pos - The byte offset into the file of this readahead request. +* @rac: The readahead request. +*/ +static inline loff_t readahead_pos (struct readahead_control *rac) +{ +return (loff_t )rac->_index *PAGE_SIZE ; +} + +/** +* readahead_length - The number of bytes in this readahead request. +* @rac: The readahead request. +*/ +static inline loff_t readahead_length (struct readahead_control *rac) +{ +return (loff_t )rac->_nr_pages *PAGE_SIZE ; +} + +/** +* readahead_index - The index of the first page in this readahead request. +* @rac: The readahead request. +*/ +static inline pgoff_t readahead_index (struct readahead_control *rac) +{ +return rac->_index; +} + +/** +* readahead_count - The number of pages in this readahead request. +* @rac: The readahead request. +*/ +static inline unsigned int readahead_count (struct readahead_control *rac) +{ +return rac->_nr_pages; +} +static inline unsigned long dir_pages (struct inode *inode) { return (unsigned long)(inode->i_size + PAGE_SIZE - 1) >>
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-use-readahead_control-to-pass-arguments.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: use readahead_control to pass arguments has been added to the -mm tree. Its filename is mm-use-readahead_control-to-pass-arguments.patch
The patch titled
Subject: mm: use readahead_control to pass arguments
has been added to the -mm tree. Its filename is
mm-use-readahead_control-to-pass-arguments.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-use-readahead_control-to-pass-arguments.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-use-readahead_control-to-pass-arguments.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: use readahead_control to pass arguments
In this patch, only between __do_page_cache_readahead() and read_pages(), but it will be extended in upcoming patches. The read_pages() function becomes aops centric, as this makes the most sense by the end of the patchset.
---
mm/readahead.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-use-readahead_control-to-pass-arguments +19 -14
@@ -113,29 +113,32 @@ int read_cache_pages(struct address_spacEXPORT_SYMBOL (read_cache_pages); -static void read_pages (struct address_space *mapping,struct file *filp, -struct list_head *pages,unsigned int nr_pages,gfp_t gfp) +static void read_pages (struct readahead_control *rac,struct list_head *pages, +gfp_t gfp) { +const struct address_space_operations *aops = rac->mapping->a_ops;struct blk_plug plug;unsigned page_idx; -if (!nr_pages) +if (!readahead_count (rac))return ;blk_start_plug (&plug); -if (mapping->a_ops->readpages) { - mapping->a_ops->readpages (filp, mapping, pages, nr_pages); +if (aops->readpages) { + aops->readpages (rac->file, rac->mapping, pages, +readahead_count (rac));/* Clean up the remaining pages */ put_pages_list (pages); goto out; } -for (page_idx =0 ; page_idx < nr_pages; page_idx++) { +for (page_idx =0 ; page_idx <readahead_count (rac); page_idx++) {struct page *page =lru_to_page (pages);list_del (&page->lru); -if (!add_to_page_cache_lru (page, mapping, page->index, gfp)) - mapping->a_ops->readpage (filp, page); +if (!add_to_page_cache_lru (page, rac->mapping, page->index, + gfp)) + aops->readpage (rac->file, page);put_page (page); }
@@ -143,6 +146,7 @@ out:blk_finish_plug (&plug);BUG_ON (!list_empty (pages)); + rac->_nr_pages =0 ; }/*
@@ -160,9 +164,12 @@ void __do_page_cache_readahead(struct adunsigned long end_index;/* The last page we want to read */ LIST_HEAD (page_pool);int page_idx; -unsigned int nr_pages =0 ;loff_t isize =i_size_read (inode);gfp_t gfp_mask =readahead_gfp_mask (mapping); +struct readahead_control rac = { + .mapping = mapping, + .file = filp, + };if (isize ==0 )return ;
@@ -185,9 +192,7 @@ void __do_page_cache_readahead(struct ad* contiguous pages before continuing with the next * batch. */ -read_pages (mapping, filp, &page_pool, nr_pages, - gfp_mask); - nr_pages =0 ; +read_pages (&rac, &page_pool, gfp_mask);continue ; }
@@ -198,7 +203,7 @@ void __do_page_cache_readahead(struct adlist_add (&page->lru, &page_pool);if (page_idx == nr_to_read - lookahead_size)SetPageReadahead (page); - nr_pages++; + rac._nr_pages++; }/*
@@ -206,7 +211,7 @@ void __do_page_cache_readahead(struct ad* uptodate then the caller will launch readpage again, and * will then handle the error. */ -read_pages (mapping, filp, &page_pool, nr_pages, gfp_mask); +read_pages (&rac, &page_pool, gfp_mask); }/*
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-rename-various-offset-parameters-to-index.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: rename various 'offset' parameters to 'index' has been added to the -mm tree. Its filename is mm-rename-various-offset-parameters-to-index.patch
The patch titled
Subject: mm: rename various 'offset' parameters to 'index'
has been added to the -mm tree. Its filename is
mm-rename-various-offset-parameters-to-index.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-rename-various-offset-parameters-to-index.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-rename-various-offset-parameters-to-index.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: rename various 'offset' parameters to 'index'
The word 'offset' is used ambiguously to mean 'byte offset within a page', 'byte offset from the start of the file' and 'page offset from the start of the file'. Use 'index' to mean 'page offset from the start of the file' throughout the readahead code.
---
mm/readahead.c | 86 ++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 44 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-rename-various-offset-parameters-to-index +42 -44
@@ -156,7 +156,7 @@ out:* We really don't want to intermingle reads and writes like that. */ void __do_page_cache_readahead (struct address_space *mapping, -struct file *filp,pgoff_t offset,unsigned long nr_to_read, +struct file *filp,pgoff_t index,unsigned long nr_to_read,unsigned long lookahead_size) {struct inode *inode = mapping->host;
@@ -180,7 +180,7 @@ void __do_page_cache_readahead(struct ad* Preallocate as many pages as we will need. */ for (page_idx =0 ; page_idx < nr_to_read; page_idx++) { -pgoff_t page_offset = offset + page_idx; +pgoff_t page_offset = index + page_idx;if (page_offset > end_index)break ;
@@ -219,7 +219,7 @@ void __do_page_cache_readahead(struct ad* memory at once. */ void force_page_cache_readahead (struct address_space *mapping, -struct file *filp,pgoff_t offset,unsigned long nr_to_read) +struct file *filp,pgoff_t index,unsigned long nr_to_read) {struct backing_dev_info *bdi =inode_to_bdi (mapping->host);struct file_ra_state *ra = &filp->f_ra;
@@ -239,9 +239,9 @@ void force_page_cache_readahead(struct aif (this_chunk > nr_to_read) this_chunk = nr_to_read; -__do_page_cache_readahead (mapping, filp, offset, this_chunk,0 ); +__do_page_cache_readahead (mapping, filp, index, this_chunk,0 ); - offset += this_chunk; + index += this_chunk; nr_to_read -= this_chunk; } }
@@ -322,21 +322,21 @@ static unsigned long get_next_ra_size(st*/ /* -* Count contiguously cached pages from @offset-1 to @offset-@max, +* Count contiguously cached pages from @index-1 to @index-@max, * this count is a conservative estimation of * - length of the sequential read sequence, or * - thrashing threshold in memory tight systems */ static pgoff_t count_history_pages (struct address_space *mapping, -pgoff_t offset,unsigned long max) +pgoff_t index,unsigned long max) {pgoff_t head;rcu_read_lock (); - head =page_cache_prev_miss (mapping, offset -1 , max); + head =page_cache_prev_miss (mapping, index -1 , max);rcu_read_unlock (); -return offset -1 - head; +return index -1 - head; }/*
@@ -344,13 +344,13 @@ static pgoff_t count_history_pages(struc*/ static int try_context_readahead (struct address_space *mapping,struct file_ra_state *ra, -pgoff_t offset, +pgoff_t index,unsigned long req_size,unsigned long max) {pgoff_t size; - size =count_history_pages (mapping, offset, max); + size =count_history_pages (mapping, index, max);/* * not enough history pages:
@@ -363,10 +363,10 @@ static int try_context_readahead(struct* starts from beginning of file: * it is a strong indication of long-run stream (or whole-file-read) */ -if (size >= offset) +if (size >= index) size *=2 ; - ra->start = offset; + ra->start = index; ra->size =min (size + req_size, max); ra->async_size =1 ;
@@ -378,13 +378,13 @@ static int try_context_readahead(struct*/ static void ondemand_readahead (struct address_space *mapping,struct file_ra_state *ra,struct file *filp, -bool hit_readahead_marker,pgoff_t offset, +bool hit_readahead_marker,pgoff_t index,unsigned long req_size) {struct backing_dev_info *bdi =inode_to_bdi (mapping->host);unsigned long max_pages = ra->ra_pages;unsigned long add_pages; -pgoff_t prev_offset; +pgoff_t prev_index;/* * If the request exceeds the readahead window, allow the read to
@@ -396,15 +396,15 @@ static void ondemand_readahead(struct ad/* * start of file */ -if (!offset) +if (!index) goto initial_readahead;/* -* It's the expected callback offset, assume sequential access. +* It's the expected callback index, assume sequential access. * Ramp up sizes, and push forward the readahead window. */ -if ((offset == (ra->start + ra->size - ra->async_size) || - offset == (ra->start + ra->size))) { +if ((index == (ra->start + ra->size - ra->async_size) || + index == (ra->start + ra->size))) { ra->start += ra->size; ra->size =get_next_ra_size (ra, max_pages); ra->async_size = ra->size;
@@ -421,14 +421,14 @@ static void ondemand_readahead(struct adpgoff_t start;rcu_read_lock (); - start =page_cache_next_miss (mapping, offset +1 , max_pages); + start =page_cache_next_miss (mapping, index +1 , max_pages);rcu_read_unlock (); -if (!start || start - offset > max_pages) +if (!start || start - index > max_pages)return ; ra->start = start; - ra->size = start - offset;/* old async_size */ + ra->size = start - index;/* old async_size */ ra->size += req_size; ra->size =get_next_ra_size (ra, max_pages); ra->async_size = ra->size;
@@ -443,29 +443,29 @@ static void ondemand_readahead(struct ad/* * sequential cache miss -* trivial case: (offset - prev_offset) == 1 -* unaligned reads: (offset - prev_offset) == 0 +* trivial case: (index - prev_index) == 1 +* unaligned reads: (index - prev_index) == 0 */ - prev_offset = (unsigned long long )ra->prev_pos >>PAGE_SHIFT ; -if (offset - prev_offset <=1UL ) + prev_index = (unsigned long long )ra->prev_pos >>PAGE_SHIFT ; +if (index - prev_index <=1UL ) goto initial_readahead;/* * Query the page cache and look for the traces(cached history pages) * that a sequential stream would leave behind. */ -if (try_context_readahead (mapping, ra, offset, req_size, max_pages)) +if (try_context_readahead (mapping, ra, index, req_size, max_pages)) goto readit;/* * standalone, small random read * Read as is, and do not pollute the readahead state. */ -__do_page_cache_readahead (mapping, filp, offset, req_size,0 ); +__do_page_cache_readahead (mapping, filp, index, req_size,0 );return ; initial_readahead: - ra->start = offset; + ra->start = index; ra->size =get_init_ra_size (req_size, max_pages); ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size;
@@ -476,7 +476,7 @@ readit:* the resulted next readahead window into the current one. * Take care of maximum IO pages as above. */ -if (offset == ra->start && ra->size == ra->async_size) { +if (index == ra->start && ra->size == ra->async_size) { add_pages =get_next_ra_size (ra, max_pages);if (ra->size + add_pages <= max_pages) { ra->async_size = add_pages;
@@ -495,9 +495,8 @@ readit:* @mapping: address_space which holds the pagecache and I/O vectors * @ra: file_ra_state which holds the readahead state * @filp: passed on to ->readpage() and ->readpages() -* @offset: start offset into @mapping, in pagecache page-sized units -* @req_size: hint: total size of the read which the caller is performing in -* pagecache pages +* @index: Index of first page to be read. +* @req_count: Total number of pages being read by the caller. * * page_cache_sync_readahead() should be called when a cache miss happened: * it will submit the read. The readahead logic may decide to piggyback more
@@ -506,7 +505,7 @@ readit:*/ void page_cache_sync_readahead (struct address_space *mapping,struct file_ra_state *ra,struct file *filp, -pgoff_t offset,unsigned long req_size) +pgoff_t index,unsigned long req_count) {/* no read-ahead */ if (!ra->ra_pages)
@@ -517,12 +516,12 @@ void page_cache_sync_readahead(struct ad/* be dumb */ if (filp && (filp->f_mode &FMODE_RANDOM )) { -force_page_cache_readahead (mapping, filp, offset, req_size); +force_page_cache_readahead (mapping, filp, index, req_count);return ; }/* do read-ahead */ -ondemand_readahead (mapping, ra, filp, false, offset, req_size); +ondemand_readahead (mapping, ra, filp, false, index, req_count); }EXPORT_SYMBOL_GPL (page_cache_sync_readahead);
@@ -531,21 +530,20 @@ EXPORT_SYMBOL_GPL(page_cache_sync_readah* @mapping: address_space which holds the pagecache and I/O vectors * @ra: file_ra_state which holds the readahead state * @filp: passed on to ->readpage() and ->readpages() -* @page: the page at @offset which has the PG_readahead flag set -* @offset: start offset into @mapping, in pagecache page-sized units -* @req_size: hint: total size of the read which the caller is performing in -* pagecache pages +* @page: The page at @index which triggered the readahead call. +* @index: Index of first page to be read. +* @req_count: Total number of pages being read by the caller. * * page_cache_async_readahead() should be called when a page is used which -* has the PG_readahead flag; this is a marker to suggest that the application +* is marked as PageReadahead; this is a marker to suggest that the application * has used up enough of the readahead window that we should start pulling in * more pages. */ void page_cache_async_readahead (struct address_space *mapping,struct file_ra_state *ra,struct file *filp, -struct page *page,pgoff_t offset, -unsigned long req_size) +struct page *page,pgoff_t index, +unsigned long req_count) {/* no read-ahead */ if (!ra->ra_pages)
@@ -569,7 +567,7 @@ page_cache_async_readahead(struct addresreturn ;/* do read-ahead */ -ondemand_readahead (mapping, ra, filp, true, offset, req_size); +ondemand_readahead (mapping, ra, filp, true, index, req_count); }EXPORT_SYMBOL_GPL (page_cache_async_readahead);
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-rename-readahead-loop-variable-to-i.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: rename readahead loop variable to 'i' has been added to the -mm tree. Its filename is mm-rename-readahead-loop-variable-to-i.patch
The patch titled
Subject: mm: rename readahead loop variable to 'i'
has been added to the -mm tree. Its filename is
mm-rename-readahead-loop-variable-to-i.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-rename-readahead-loop-variable-to-i.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-rename-readahead-loop-variable-to-i.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: rename readahead loop variable to 'i'
Change the type of page_idx to unsigned long, and rename it -- it's just a loop counter, not a page index.
---
mm/readahead.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-rename-readahead-loop-variable-to-i +4 -4
@@ -163,13 +163,13 @@ void __do_page_cache_readahead(struct adstruct page *page;unsigned long end_index;/* The last page we want to read */ LIST_HEAD (page_pool); -int page_idx;loff_t isize =i_size_read (inode);gfp_t gfp_mask =readahead_gfp_mask (mapping);struct readahead_control rac = { .mapping = mapping, .file = filp, }; +unsigned long i;if (isize ==0 )return ;
@@ -179,8 +179,8 @@ void __do_page_cache_readahead(struct ad/* * Preallocate as many pages as we will need. */ -for (page_idx =0 ; page_idx < nr_to_read; page_idx++) { -pgoff_t page_offset = index + page_idx; +for (i =0 ; i < nr_to_read; i++) { +pgoff_t page_offset = index + i;if (page_offset > end_index)break ;
@@ -201,7 +201,7 @@ void __do_page_cache_readahead(struct adbreak ; page->index = page_offset;list_add (&page->lru, &page_pool); -if (page_idx == nr_to_read - lookahead_size) +if (i == nr_to_read - lookahead_size)SetPageReadahead (page); rac._nr_pages++; }
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-remove-page_offset-from-readahead-loop.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove 'page_offset' from readahead loop has been added to the -mm tree. Its filename is mm-remove-page_offset-from-readahead-loop.patch
The patch titled
Subject: mm: remove 'page_offset' from readahead loop
has been added to the -mm tree. Its filename is
mm-remove-page_offset-from-readahead-loop.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-page_offset-from-readahead-loop.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-page_offset-from-readahead-loop.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: remove 'page_offset' from readahead loop
Replace the page_offset variable with 'index + i'.
---
mm/readahead.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-remove-page_offset-from-readahead-loop +3 -5
@@ -180,12 +180,10 @@ void __do_page_cache_readahead(struct ad* Preallocate as many pages as we will need. */ for (i =0 ; i < nr_to_read; i++) { -pgoff_t page_offset = index + i; - -if (page_offset > end_index) +if (index + i > end_index)break ; - page =xa_load (&mapping->i_pages, page_offset); + page =xa_load (&mapping->i_pages, index + i);if (page && !xa_is_value (page)) {/* * Page already present? Kick off the current batch of
@@ -199,7 +197,7 @@ void __do_page_cache_readahead(struct ad page =__page_cache_alloc (gfp_mask);if (!page)break ; - page->index = page_offset; + page->index = index + i;list_add (&page->lru, &page_pool);if (i == nr_to_read - lookahead_size)SetPageReadahead (page);
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-put-readahead-pages-in-cache-earlier.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: put readahead pages in cache earlier has been added to the -mm tree. Its filename is mm-put-readahead-pages-in-cache-earlier.patch
The patch titled
Subject: mm: put readahead pages in cache earlier
has been added to the -mm tree. Its filename is
mm-put-readahead-pages-in-cache-earlier.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-put-readahead-pages-in-cache-earlier.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-put-readahead-pages-in-cache-earlier.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: put readahead pages in cache earlier
When populating the page cache for readahead, mappings that use ->readpages must populate the page cache themselves as the pages are passed on a linked list which would normally be used for the page cache's LRU. For mappings that use ->readpage or the upcoming ->readahead method, we can put the pages into the page cache as soon as they're allocated, which solves a race between readahead and direct IO. It also lets us remove the gfp argument from read_pages().
Use the new readahead_page() API to implement the repeated calls to ->readpage(), just like most filesystems will.
---
mm/readahead.c | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-put-readahead-pages-in-cache-earlier +28 -18
@@ -114,14 +114,14 @@ int read_cache_pages(struct address_spacEXPORT_SYMBOL (read_cache_pages);static void read_pages (struct readahead_control *rac,struct list_head *pages, -gfp_t gfp) +bool skip_page) {const struct address_space_operations *aops = rac->mapping->a_ops; +struct page *page;struct blk_plug plug; -unsigned page_idx;if (!readahead_count (rac)) -return ; + goto out;blk_start_plug (&plug);
@@ -130,23 +130,23 @@ static void read_pages(struct readahead_ readahead_count(rac));/* Clean up the remaining pages */ put_pages_list (pages); - goto out; - } - -for (page_idx =0 ; page_idx <readahead_count (rac); page_idx++) { -struct page *page =lru_to_page (pages); -list_del (&page->lru); -if (!add_to_page_cache_lru (page, rac->mapping, page->index, - gfp)) + rac->_index += rac->_nr_pages; + rac->_nr_pages =0 ; + }else { +while ((page =readahead_page (rac))) { aops->readpage (rac->file, page); -put_page (page); +put_page (page); + } } -out:blk_finish_plug (&plug);BUG_ON (!list_empty (pages)); - rac->_nr_pages =0 ; +BUG_ON (readahead_count (rac)); + +out: +if (skip_page) + rac->_index++; }/*
@@ -168,6 +168,7 @@ void __do_page_cache_readahead(struct adstruct readahead_control rac = { .mapping = mapping, .file = filp, + ._index = index, };unsigned long i;
@@ -183,6 +184,8 @@ void __do_page_cache_readahead(struct adif (index + i > end_index)break ; +BUG_ON (index + i != rac._index + rac._nr_pages); + page =xa_load (&mapping->i_pages, index + i);if (page && !xa_is_value (page)) {/*
@@ -190,15 +193,22 @@ void __do_page_cache_readahead(struct ad* contiguous pages before continuing with the next * batch. */ -read_pages (&rac, &page_pool, gfp_mask); +read_pages (&rac, &page_pool, true);continue ; } page =__page_cache_alloc (gfp_mask);if (!page)break ; - page->index = index + i; -list_add (&page->lru, &page_pool); +if (mapping->a_ops->readpages) { + page->index = index + i; +list_add (&page->lru, &page_pool); + }else if (add_to_page_cache_lru (page, mapping, index + i, + gfp_mask) <0 ) { +put_page (page); +read_pages (&rac, &page_pool, true); +continue ; + }if (i == nr_to_read - lookahead_size)SetPageReadahead (page); rac._nr_pages++;
@@ -209,7 +219,7 @@ void __do_page_cache_readahead(struct ad* uptodate then the caller will launch readpage again, and * will then handle the error. */ -read_pages (&rac, &page_pool, gfp_mask); +read_pages (&rac, &page_pool, false); }/*
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-add-readahead-address-space-operation.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: add readahead address space operation has been added to the -mm tree. Its filename is mm-add-readahead-address-space-operation.patch
The patch titled
Subject: mm: add readahead address space operation
has been added to the -mm tree. Its filename is
mm-add-readahead-address-space-operation.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-add-readahead-address-space-operation.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-add-readahead-address-space-operation.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: add readahead address space operation
This replaces ->readpages with a saner interface:
- Return void instead of an ignored error code.
- Page cache is already populated with locked pages when ->readahead is called.
- New arguments can be passed to the implementation without changing all the filesystems that use a common helper function like mpage_readahead().
---
Documentation/filesystems/locking.rst | 6 +++++- Documentation/filesystems/vfs.rst | 15 +++++++++++++++ include/linux/fs.h | 2 ++ mm/readahead.c | 12 ++++++++++-- 4 files changed, 32 insertions(+), 3 deletions(-)
Documentation/filesystems/locking.rst renamed from Documentation/filesystems/locking.rst~mm-add-readahead-address-space-operation +5 -1
@@ -239,6 +239,7 @@ prototypes:: int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *page); + void (*readahead)(struct readahead_control *); int (*readpages)(struct file *filp, struct address_space *mapping, struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping,
@@ -271,7 +272,8 @@ writepage: yes, unlocks (see below) readpage: yes, unlocks writepages: set_page_dirty no -readpages: +readahead: yes, unlocks +readpages: no write_begin: locks the page exclusive write_end: yes, unlocks exclusive bmap:
@@ -295,6 +297,8 @@ the request handler (/dev/loop). ->readpage() unlocks the page, either synchronously or via I/O completion. +->readahead() unlocks the pages that I/O is attempted on like ->readpage(). + ->readpages() populates the pagecache with the passed pages and starts I/O against them. They come unlocked upon I/O completion.
Documentation/filesystems/vfs.rst renamed from Documentation/filesystems/vfs.rst~mm-add-readahead-address-space-operation +15 -0
@@ -706,6 +706,7 @@ cache in your filesystem. The following int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *page); + void (*readahead)(struct readahead_control *); int (*readpages)(struct file *filp, struct address_space *mapping, struct list_head *pages, unsigned nr_pages); int (*write_begin)(struct file *, struct address_space *mapping,
@@ -781,12 +782,26 @@ cache in your filesystem. The following If defined, it should set the PageDirty flag, and the PAGECACHE_TAG_DIRTY tag in the radix tree. +``readahead`` + Called by the VM to read pages associated with the address_space + object. The pages are consecutive in the page cache and are + locked. The implementation should decrement the page refcount + after starting I/O on each page. Usually the page will be + unlocked by the I/O completion handler. If the filesystem decides + to stop attempting I/O before reaching the end of the readahead + window, it can simply return. The caller will decrement the page + refcount and unlock the remaining pages for you. Set PageUptodate + if the I/O completes successfully. Setting PageError on any page + will be ignored; simply unlock the page if an I/O error occurs. + ``readpages`` called by the VM to read pages associated with the address_space object. This is essentially just a vector version of readpage. Instead of just one page, several pages are requested. readpages is only used for read-ahead, so read errors are ignored. If anything goes wrong, feel free to give up. + This interface is deprecated and will be removed by the end of + 2020; implement readahead instead. ``write_begin`` Called by the generic buffered write code to ask the filesystem
include/linux/fs.h renamed from include/linux/fs.h~mm-add-readahead-address-space-operation +2 -0
@@ -292,6 +292,7 @@ enum positive_aop_returns {struct page ;struct address_space ;struct writeback_control ; +struct readahead_control ;/* * Write life time hint values.
@@ -375,6 +376,7 @@ struct address_space_operations {*/ int (*readpages)(struct file *filp,struct address_space *mapping,struct list_head *pages,unsigned nr_pages); +void (*readahead)(struct readahead_control *); int (*write_begin)(struct file *, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags,
mm/readahead.c renamed from mm/readahead.c~mm-add-readahead-address-space-operation +10 -2
@@ -125,7 +125,14 @@ static void read_pages(struct readahead_blk_start_plug (&plug); -if (aops->readpages) { +if (aops->readahead) { + aops->readahead (rac); +/* Clean up the remaining pages */ +while ((page =readahead_page (rac))) { +unlock_page (page); +put_page (page); + } + }else if (aops->readpages) { aops->readpages (rac->file, rac->mapping, pages,readahead_count (rac));/* Clean up the remaining pages */
@@ -233,7 +240,8 @@ void force_page_cache_readahead(struct astruct file_ra_state *ra = &filp->f_ra;unsigned long max_pages; -if (unlikely (!mapping->a_ops->readpage && !mapping->a_ops->readpages)) +if (unlikely (!mapping->a_ops->readpage && !mapping->a_ops->readpages && + !mapping->a_ops->readahead))return ;/*
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-move-end_index-check-out-of-readahead-loop.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: move end_index check out of readahead loop has been added to the -mm tree. Its filename is mm-move-end_index-check-out-of-readahead-loop.patch
The patch titled
Subject: mm: move end_index check out of readahead loop
has been added to the -mm tree. Its filename is
mm-move-end_index-check-out-of-readahead-loop.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-move-end_index-check-out-of-readahead-loop.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-move-end_index-check-out-of-readahead-loop.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: move end_index check out of readahead loop
By reducing nr_to_read, we can eliminate this check from inside the loop.
---
mm/readahead.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-move-end_index-check-out-of-readahead-loop +8 -6
@@ -167,8 +167,6 @@ void __do_page_cache_readahead(struct ad unsigned long lookahead_size) {struct inode *inode = mapping->host; -struct page *page; -unsigned long end_index;/* The last page we want to read */ LIST_HEAD (page_pool);loff_t isize =i_size_read (inode);gfp_t gfp_mask =readahead_gfp_mask (mapping);
@@ -178,22 +176,26 @@ void __do_page_cache_readahead(struct ad ._index = index, };unsigned long i; +pgoff_t end_index;/* The last page we want to read */ if (isize ==0 )return ; - end_index = ((isize -1 ) >>PAGE_SHIFT ); + end_index = (isize -1 ) >>PAGE_SHIFT ; +if (index > end_index) +return ; +/* Don't read past the page containing the last byte of the file */ +if (nr_to_read > end_index - index) + nr_to_read = end_index - index +1 ;/* * Preallocate as many pages as we will need. */ for (i =0 ; i < nr_to_read; i++) { -if (index + i > end_index) -break ; +struct page *page =xa_load (&mapping->i_pages, index + i);BUG_ON (index + i != rac._index + rac._nr_pages); - page =xa_load (&mapping->i_pages, index + i);if (page && !xa_is_value (page)) {/* * Page already present? Kick off the current batch of
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-add-page_cache_readahead_unbounded.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: add page_cache_readahead_unbounded has been added to the -mm tree. Its filename is mm-add-page_cache_readahead_unbounded.patch
The patch titled
Subject: mm: add page_cache_readahead_unbounded
has been added to the -mm tree. Its filename is
mm-add-page_cache_readahead_unbounded.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-add-page_cache_readahead_unbounded.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-add-page_cache_readahead_unbounded.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: add page_cache_readahead_unbounded
ext4 and f2fs have duplicated the guts of the readahead code so they can read past i_size. Instead, separate out the guts of the readahead code so they can call it directly.
---
fs/ext4/verity.c | 35 +------------------ fs/f2fs/data.c | 2 - fs/f2fs/f2fs.h | 3 - fs/f2fs/verity.c | 35 +------------------ include/linux/pagemap.h | 3 + mm/readahead.c | 68 ++++++++++++++++++++++++++------------ 6 files changed, 55 insertions(+), 91 deletions(-)
fs/ext4/verity.c renamed from fs/ext4/verity.c~mm-add-page_cache_readahead_unbounded +2 -33
@@ -342,37 +342,6 @@ static int ext4_get_verity_descriptor(streturn desc_size; } -/* -* Prefetch some pages from the file's Merkle tree. -* -* This is basically a stripped-down version of __do_page_cache_readahead() -* which works on pages past i_size. -*/ -static void ext4_merkle_tree_readahead (struct address_space *mapping, -pgoff_t start_index,unsigned long count) -{ -LIST_HEAD (pages); -unsigned int nr_pages =0 ; -struct page *page; -pgoff_t index; -struct blk_plug plug; - -for (index = start_index; index < start_index + count; index++) { - page =xa_load (&mapping->i_pages, index); -if (!page ||xa_is_value (page)) { - page =__page_cache_alloc (readahead_gfp_mask (mapping)); -if (!page) -break ; - page->index = index; -list_add (&page->lru, &pages); - nr_pages++; - } - } -blk_start_plug (&plug); -ext4_mpage_readpages (mapping, &pages,NULL , nr_pages, true); -blk_finish_plug (&plug); -} -static struct page *ext4_read_merkle_tree_page (struct inode *inode,pgoff_t index,unsigned long num_ra_pages)
@@ -386,8 +355,8 @@ static struct page *ext4_read_merkle_treif (page)put_page (page);else if (num_ra_pages >1 ) -ext4_merkle_tree_readahead (inode->i_mapping, index, - num_ra_pages); +page_cache_readahead_unbounded (inode->i_mapping,NULL , + index, num_ra_pages,0 ); page =read_mapping_page (inode->i_mapping, index,NULL ); }return page;
fs/f2fs/data.c renamed from fs/f2fs/data.c~mm-add-page_cache_readahead_unbounded +1 -1
@@ -2177,7 +2177,7 @@ out:* use ->readpage() or do the necessary surgery to decouple ->readpages() * from read-ahead. */ -int f2fs_mpage_readpages (struct address_space *mapping, +static int f2fs_mpage_readpages (struct address_space *mapping,struct list_head *pages,struct page *page,unsigned nr_pages,bool is_readahead) {
fs/f2fs/f2fs.h renamed from fs/f2fs/f2fs.h~mm-add-page_cache_readahead_unbounded +0 -3
@@ -3373,9 +3373,6 @@ int f2fs_reserve_new_block(struct dnode_int f2fs_get_block (struct dnode_of_data *dn,pgoff_t index);int f2fs_preallocate_blocks (struct kiocb *iocb,struct iov_iter *from);int f2fs_reserve_block (struct dnode_of_data *dn,pgoff_t index); -int f2fs_mpage_readpages (struct address_space *mapping, -struct list_head *pages,struct page *page, -unsigned nr_pages,bool is_readahead);struct page *f2fs_get_read_data_page (struct inode *inode,pgoff_t index,int op_flags,bool for_write);struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index);
fs/f2fs/verity.c renamed from fs/f2fs/verity.c~mm-add-page_cache_readahead_unbounded +2 -33
@@ -222,37 +222,6 @@ static int f2fs_get_verity_descriptor(streturn size; } -/* -* Prefetch some pages from the file's Merkle tree. -* -* This is basically a stripped-down version of __do_page_cache_readahead() -* which works on pages past i_size. -*/ -static void f2fs_merkle_tree_readahead (struct address_space *mapping, -pgoff_t start_index,unsigned long count) -{ -LIST_HEAD (pages); -unsigned int nr_pages =0 ; -struct page *page; -pgoff_t index; -struct blk_plug plug; - -for (index = start_index; index < start_index + count; index++) { - page =xa_load (&mapping->i_pages, index); -if (!page ||xa_is_value (page)) { - page =__page_cache_alloc (readahead_gfp_mask (mapping)); -if (!page) -break ; - page->index = index; -list_add (&page->lru, &pages); - nr_pages++; - } - } -blk_start_plug (&plug); -f2fs_mpage_readpages (mapping, &pages,NULL , nr_pages, true); -blk_finish_plug (&plug); -} -static struct page *f2fs_read_merkle_tree_page (struct inode *inode,pgoff_t index,unsigned long num_ra_pages)
@@ -266,8 +235,8 @@ static struct page *f2fs_read_merkle_treif (page)put_page (page);else if (num_ra_pages >1 ) -f2fs_merkle_tree_readahead (inode->i_mapping, index, - num_ra_pages); +page_cache_readahead_unbounded (inode->i_mapping,NULL , + index, num_ra_pages,0 ); page =read_mapping_page (inode->i_mapping, index,NULL ); }return page;
include/linux/pagemap.h renamed from include/linux/pagemap.h~mm-add-page_cache_readahead_unbounded +3 -0
@@ -622,6 +622,9 @@ void page_cache_sync_readahead(struct advoid page_cache_async_readahead (struct address_space *,struct file_ra_state *,struct file *,struct page *,pgoff_t index,unsigned long req_count); +void page_cache_readahead_unbounded (struct address_space *,struct file *, +pgoff_t index,unsigned long nr_to_read, +unsigned long lookahead_count);/* * Like add_to_page_cache_locked, but used to add newly allocated pages:
mm/readahead.c renamed from mm/readahead.c~mm-add-page_cache_readahead_unbounded +47 -21
90 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-document-why-we-dont-set-pagereadahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: document why we don't set PageReadahead has been added to the -mm tree. Its filename is mm-document-why-we-dont-set-pagereadahead.patch
The patch titled
Subject: mm: document why we don't set PageReadahead
has been added to the -mm tree. Its filename is
mm-document-why-we-dont-set-pagereadahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-document-why-we-dont-set-pagereadahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-document-why-we-dont-set-pagereadahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: document why we don't set PageReadahead
If the page is already in cache, we don't set PageReadahead on it.
---
mm/readahead.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
mm/readahead.c renamed from mm/readahead.c~mm-document-why-we-dont-set-pagereadahead +6 -3
@@ -195,9 +195,12 @@ void page_cache_readahead_unbounded(struif (page && !xa_is_value (page)) {/* -* Page already present? Kick off the current batch of -* contiguous pages before continuing with the next -* batch. +* Page already present? Kick off the current batch +* of contiguous pages before continuing with the +* next batch. This page may be the one we would +* have intended to mark as Readahead, but we don't +* have a stable reference to this page, and it's +* not worth getting one just for that. */ read_pages (&rac, &page_pool, true);continue ;
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-use-memalloc_nofs_save-in-readahead-path.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: use memalloc_nofs_save in readahead path has been added to the -mm tree. Its filename is mm-use-memalloc_nofs_save-in-readahead-path.patch
The patch titled
Subject: mm: use memalloc_nofs_save in readahead path
has been added to the -mm tree. Its filename is
mm-use-memalloc_nofs_save-in-readahead-path.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-use-memalloc_nofs_save-in-readahead-path.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-use-memalloc_nofs_save-in-readahead-path.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: use memalloc_nofs_save in readahead path
Ensure that memory allocations in the readahead path do not attempt to reclaim file-backed pages, which could lead to a deadlock. It is possible, though unlikely this is the root cause of a problem observed by Cong Wang.
---
mm/readahead.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
mm/readahead.c renamed from mm/readahead.c~mm-use-memalloc_nofs_save-in-readahead-path +14 -0
@@ -22,6 +22,7 @@#include <linux/mm_inline.h> #include <linux/blk-cgroup.h> #include <linux/fadvise.h> +#include <linux/sched/mm.h> #include "internal.h"
@@ -186,6 +187,18 @@ void page_cache_readahead_unbounded(struunsigned long i;/* +* Partway through the readahead operation, we will have added +* locked pages to the page cache, but will not yet have submitted +* them for I/O. Adding another page may need to allocate memory, +* which can trigger memory reclaim. Telling the VM we're in +* the middle of a filesystem operation will cause it to not +* touch file-backed pages, preventing a deadlock. Most (all?) +* filesystems already specify __GFP_NOFS in their mapping's +* gfp_mask, but let's be explicit here. +*/ +unsigned int nofs =memalloc_nofs_save (); + +/* * Preallocate as many pages as we will need. */ for (i =0 ; i < nr_to_read; i++) {
@@ -229,6 +242,7 @@ void page_cache_readahead_unbounded(stru* will then handle the error. */ read_pages (&rac, &page_pool, false); +memalloc_nofs_restore (nofs); }EXPORT_SYMBOL_GPL (page_cache_readahead_unbounded);
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ fs-convert-mpage_readpages-to-mpage_readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: fs: convert mpage_readpages to mpage_readahead has been added to the -mm tree. Its filename is fs-convert-mpage_readpages-to-mpage_readahead.patch
The patch titled
Subject: fs: convert mpage_readpages to mpage_readahead
has been added to the -mm tree. Its filename is
fs-convert-mpage_readpages-to-mpage_readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/fs-convert-mpage_readpages-to-mpage_readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/fs-convert-mpage_readpages-to-mpage_readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: fs: convert mpage_readpages to mpage_readahead
Implement the new readahead aop and convert all callers (block_dev, exfat, ext2, fat, gfs2, hpfs, isofs, jfs, nilfs2, ocfs2, omfs, qnx6, reiserfs & udf). The callers are all trivial except for GFS2 & OCFS2.
---
fs/block_dev.c | 7 +++---- fs/exfat/inode.c | 7 +++---- fs/ext2/inode.c | 10 ++++------ fs/fat/inode.c | 7 +++---- fs/gfs2/aops.c | 23 ++++++++--------------- fs/hpfs/file.c | 7 +++---- fs/iomap/buffered-io.c | 2 +- fs/isofs/inode.c | 7 +++---- fs/jfs/inode.c | 7 +++---- fs/mpage.c | 38 +++++++++++--------------------------- fs/nilfs2/inode.c | 15 +++------------ fs/ocfs2/aops.c | 34 +++++++++++++--------------------- fs/omfs/file.c | 7 +++---- fs/qnx6/inode.c | 7 +++---- fs/reiserfs/inode.c | 8 +++----- fs/udf/inode.c | 7 +++---- include/linux/mpage.h | 4 ++-- mm/migrate.c | 2 +- 18 files changed, 73 insertions(+), 126 deletions(-)
fs/block_dev.c renamed from fs/block_dev.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -615,10 +615,9 @@ static int blkdev_readpage(struct file *return block_read_full_page (page, blkdev_get_block); } -static int blkdev_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void blkdev_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, blkdev_get_block); +mpage_readahead (rac, blkdev_get_block); } static int blkdev_write_begin(struct file *file, struct address_space *mapping,
@@ -2076,7 +2075,7 @@ static int blkdev_writepages(struct addrstatic const struct address_space_operations def_blk_aops = { .readpage = blkdev_readpage, - .readpages = blkdev_readpages, + .readahead = blkdev_readahead, .writepage = blkdev_writepage, .write_begin = blkdev_write_begin, .write_end = blkdev_write_end,
fs/exfat/inode.c renamed from fs/exfat/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -372,10 +372,9 @@ static int exfat_readpage(struct file *freturn mpage_readpage (page, exfat_get_block); } -static int exfat_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned int nr_pages) +static void exfat_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, exfat_get_block); +mpage_readahead (rac, exfat_get_block); }static int exfat_writepage (struct page *page,struct writeback_control *wbc)
@@ -502,7 +501,7 @@ int exfat_block_truncate_page(struct inostatic const struct address_space_operations exfat_aops = { .readpage = exfat_readpage, - .readpages = exfat_readpages, + .readahead = exfat_readahead, .writepage = exfat_writepage, .writepages = exfat_writepages, .write_begin = exfat_write_begin,
fs/ext2/inode.c renamed from fs/ext2/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +4 -6
@@ -877,11 +877,9 @@ static int ext2_readpage(struct file *fireturn mpage_readpage (page, ext2_get_block); } -static int -ext2_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void ext2_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, ext2_get_block); +mpage_readahead (rac, ext2_get_block); } static int
@@ -967,7 +965,7 @@ ext2_dax_writepages(struct address_spaceconst struct address_space_operations ext2_aops = { .readpage = ext2_readpage, - .readpages = ext2_readpages, + .readahead = ext2_readahead, .writepage = ext2_writepage, .write_begin = ext2_write_begin, .write_end = ext2_write_end,
@@ -981,7 +979,7 @@ const struct address_space_operations exconst struct address_space_operations ext2_nobh_aops = { .readpage = ext2_readpage, - .readpages = ext2_readpages, + .readahead = ext2_readahead, .writepage = ext2_nobh_writepage, .write_begin = ext2_nobh_write_begin, .write_end = nobh_write_end,
fs/fat/inode.c renamed from fs/fat/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -210,10 +210,9 @@ static int fat_readpage(struct file *filreturn mpage_readpage (page, fat_get_block); } -static int fat_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void fat_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, fat_get_block); +mpage_readahead (rac, fat_get_block); }static void fat_write_failed (struct address_space *mapping,loff_t to)
@@ -344,7 +343,7 @@ int fat_block_truncate_page(struct inodestatic const struct address_space_operations fat_aops = { .readpage = fat_readpage, - .readpages = fat_readpages, + .readahead = fat_readahead, .writepage = fat_writepage, .writepages = fat_writepages, .write_begin = fat_write_begin,
fs/gfs2/aops.c renamed from fs/gfs2/aops.c~fs-convert-mpage_readpages-to-mpage_readahead +8 -15
@@ -577,7 +577,7 @@ int gfs2_internal_read(struct gfs2_inode }/** -* gfs2_readpages - Read a bunch of pages at once +* gfs2_readahead - Read a bunch of pages at once * @file: The file to read from * @mapping: Address space info * @pages: List of pages to read
@@ -590,31 +590,24 @@ int gfs2_internal_read(struct gfs2_inode* obviously not something we'd want to do on too regular a basis. * Any I/O we ignore at this time will be done via readpage later. * 2. We don't handle stuffed files here we let readpage do the honours. -* 3. mpage_readpages() does most of the heavy lifting in the common case. +* 3. mpage_readahead() does most of the heavy lifting in the common case. * 4. gfs2_block_map() is relied upon to set BH_Boundary in the right places. */ -static int gfs2_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void gfs2_readahead (struct readahead_control *rac) { -struct inode *inode = mapping->host; +struct inode *inode = rac->mapping->host;struct gfs2_inode *ip =GFS2_I (inode); -struct gfs2_sbd *sdp =GFS2_SB (inode);struct gfs2_holder gh; -int ret;gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); - ret =gfs2_glock_nq (&gh); -if (unlikely (ret)) +if (gfs2_glock_nq (&gh)) goto out_uninit;if (!gfs2_is_stuffed (ip)) - ret =mpage_readpages (mapping, pages, nr_pages, gfs2_block_map); +mpage_readahead (rac, gfs2_block_map);gfs2_glock_dq (&gh); out_uninit:gfs2_holder_uninit (&gh); -if (unlikely (gfs2_withdrawn (sdp))) - ret = -EIO ; -return ret; }/**
@@ -833,7 +826,7 @@ static const struct address_space_operat .writepage = gfs2_writepage, .writepages = gfs2_writepages, .readpage = gfs2_readpage, - .readpages = gfs2_readpages, + .readahead = gfs2_readahead, .bmap = gfs2_bmap, .invalidatepage = gfs2_invalidatepage, .releasepage = gfs2_releasepage,
@@ -847,7 +840,7 @@ static const struct address_space_operat .writepage = gfs2_jdata_writepage, .writepages = gfs2_jdata_writepages, .readpage = gfs2_readpage, - .readpages = gfs2_readpages, + .readahead = gfs2_readahead, .set_page_dirty = jdata_set_page_dirty, .bmap = gfs2_bmap, .invalidatepage = gfs2_invalidatepage,
fs/hpfs/file.c renamed from fs/hpfs/file.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -125,10 +125,9 @@ static int hpfs_writepage(struct page *preturn block_write_full_page (page, hpfs_get_block, wbc); } -static int hpfs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void hpfs_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, hpfs_get_block); +mpage_readahead (rac, hpfs_get_block); } static int hpfs_writepages(struct address_space *mapping,
@@ -198,7 +197,7 @@ static int hpfs_fiemap(struct inode *inoconst struct address_space_operations hpfs_aops = { .readpage = hpfs_readpage, .writepage = hpfs_writepage, - .readpages = hpfs_readpages, + .readahead = hpfs_readahead, .writepages = hpfs_writepages, .write_begin = hpfs_write_begin, .write_end = hpfs_write_end,
fs/iomap/buffered-io.c renamed from fs/iomap/buffered-io.c~fs-convert-mpage_readpages-to-mpage_readahead +1 -1
@@ -367,7 +367,7 @@ iomap_readpage(struct page *page, const }/* -* Just like mpage_readpages and block_read_full_page we always +* Just like mpage_readahead and block_read_full_page we always * return 0 and just mark the page as PageError on errors. This * should be cleaned up all through the stack eventually. */
fs/isofs/inode.c renamed from fs/isofs/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -1185,10 +1185,9 @@ static int isofs_readpage(struct file *freturn mpage_readpage (page, isofs_get_block); } -static int isofs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void isofs_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, isofs_get_block); +mpage_readahead (rac, isofs_get_block); }static sector_t _isofs_bmap (struct address_space *mapping,sector_t block)
@@ -1198,7 +1197,7 @@ static sector_t _isofs_bmap(struct addrestatic const struct address_space_operations isofs_aops = { .readpage = isofs_readpage, - .readpages = isofs_readpages, + .readahead = isofs_readahead, .bmap = _isofs_bmap };
fs/jfs/inode.c renamed from fs/jfs/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -296,10 +296,9 @@ static int jfs_readpage(struct file *filreturn mpage_readpage (page, jfs_get_block); } -static int jfs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void jfs_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, jfs_get_block); +mpage_readahead (rac, jfs_get_block); }static void jfs_write_failed (struct address_space *mapping,loff_t to)
@@ -358,7 +357,7 @@ static ssize_t jfs_direct_IO(struct kiocconst struct address_space_operations jfs_aops = { .readpage = jfs_readpage, - .readpages = jfs_readpages, + .readahead = jfs_readahead, .writepage = jfs_writepage, .writepages = jfs_writepages, .write_begin = jfs_write_begin,
fs/mpage.c renamed from fs/mpage.c~fs-convert-mpage_readpages-to-mpage_readahead +11 -27
@@ -91,7 +91,7 @@ mpage_alloc(struct block_device *bdev, }/* -* support function for mpage_readpages. The fs supplied get_block might +* support function for mpage_readahead. The fs supplied get_block might * return an up to date buffer. This is used to map that buffer into * the page, which allows readpage to avoid triggering a duplicate call * to get_block.
@@ -338,13 +338,8 @@ confused: }/** -* mpage_readpages - populate an address space with some pages & start reads against them -* @mapping: the address_space -* @pages: The address of a list_head which contains the target pages. These -* pages have their ->index populated and are otherwise uninitialised. -* The page at @pages->prev has the lowest file offset, and reads should be -* issued in @pages->prev to @pages->next order. -* @nr_pages: The number of pages at *@pages +* mpage_readahead - start reads against pages +* @rac: Describes which pages to read. * @get_block: The filesystem's block mapper function. * * This function walks the pages and the blocks within each page, building and
@@ -381,36 +376,25 @@ confused:* * This all causes the disk requests to be issued in the correct order. */ -int -mpage_readpages (struct address_space *mapping,struct list_head *pages, -unsigned nr_pages,get_block_t get_block) +void mpage_readahead (struct readahead_control *rac,get_block_t get_block) { +struct page *page;struct mpage_readpage_args args = { .get_block = get_block, .is_readahead = true, }; -unsigned page_idx; - -for (page_idx =0 ; page_idx < nr_pages; page_idx++) { -struct page *page =lru_to_page (pages); +while ((page =readahead_page (rac))) {prefetchw (&page->flags); -list_del (&page->lru); -if (!add_to_page_cache_lru (page, mapping, - page->index, -readahead_gfp_mask (mapping))) { - args.page = page; - args.nr_pages = nr_pages - page_idx; - args.bio =do_mpage_readpage (&args); - } + args.page = page; + args.nr_pages =readahead_count (rac); + args.bio =do_mpage_readpage (&args);put_page (page); } -BUG_ON (!list_empty (pages));if (args.bio)mpage_bio_submit (REQ_OP_READ ,REQ_RAHEAD , args.bio); -return 0 ; } -EXPORT_SYMBOL (mpage_readpages); +EXPORT_SYMBOL (mpage_readahead);/* * This isn't called much at all
@@ -563,7 +547,7 @@ static int __mpage_writepage(struct page* Page has buffers, but they are all unmapped. The page was * created by pagein or read over a hole which was handled by * block_read_full_page(). If this address_space is also -* using mpage_readpages then this can rarely happen. +* using mpage_readahead then this can rarely happen. */ goto confused; }
fs/nilfs2/inode.c renamed from fs/nilfs2/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -12
@@ -145,18 +145,9 @@ static int nilfs_readpage(struct file *freturn mpage_readpage (page, nilfs_get_block); } -/** -* nilfs_readpages() - implement readpages() method of nilfs_aops {} -* address_space_operations. -* @file - file struct of the file to be read -* @mapping - address_space struct used for reading multiple pages -* @pages - the pages to be read -* @nr_pages - number of pages to be read -*/ -static int nilfs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned int nr_pages) +static void nilfs_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, nilfs_get_block); +mpage_readahead (rac, nilfs_get_block); } static int nilfs_writepages(struct address_space *mapping,
@@ -308,7 +299,7 @@ const struct address_space_operations ni .readpage = nilfs_readpage, .writepages = nilfs_writepages, .set_page_dirty = nilfs_set_page_dirty, - .readpages = nilfs_readpages, + .readahead = nilfs_readahead, .write_begin = nilfs_write_begin, .write_end = nilfs_write_end,/* .releasepage = nilfs_releasepage, */
fs/ocfs2/aops.c renamed from fs/ocfs2/aops.c~fs-convert-mpage_readpages-to-mpage_readahead +13 -21
@@ -350,14 +350,11 @@ out:* grow out to a tree. If need be, detecting boundary extents could * trivially be added in a future version of ocfs2_get_block(). */ -static int ocfs2_readpages (struct file *filp,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void ocfs2_readahead (struct readahead_control *rac) { -int ret, err = -EIO ; -struct inode *inode = mapping->host; +int ret; +struct inode *inode = rac->mapping->host;struct ocfs2_inode_info *oi =OCFS2_I (inode); -loff_t start; -struct page *last;/* * Use the nonblocking flag for the dlm code to avoid page
@@ -365,36 +362,31 @@ static int ocfs2_readpages(struct file **/ ret =ocfs2_inode_lock_full (inode,NULL ,0 ,OCFS2_LOCK_NONBLOCK );if (ret) -return err; +return ; -if (down_read_trylock (&oi->ip_alloc_sem) ==0 ) { -ocfs2_inode_unlock (inode,0 ); -return err; - } +if (down_read_trylock (&oi->ip_alloc_sem) ==0 ) + goto out_unlock;/* * Don't bother with inline-data. There isn't anything * to read-ahead in that case anyway... */ if (oi->ip_dyn_features &OCFS2_INLINE_DATA_FL ) - goto out_unlock; + goto out_up;/* * Check whether a remote node truncated this file - we just * drop out in that case as it's not worth handling here. */ - last =lru_to_page (pages); - start = (loff_t )last->index <<PAGE_SHIFT ; -if (start >=i_size_read (inode)) - goto out_unlock; +if (readahead_pos (rac) >=i_size_read (inode)) + goto out_up; - err =mpage_readpages (mapping, pages, nr_pages, ocfs2_get_block); +mpage_readahead (rac, ocfs2_get_block); -out_unlock: +out_up:up_read (&oi->ip_alloc_sem); +out_unlock:ocfs2_inode_unlock (inode,0 ); - -return err; }/* Note: Because we don't support holes, our allocation has
@@ -2474,7 +2466,7 @@ static ssize_t ocfs2_direct_IO(struct kiconst struct address_space_operations ocfs2_aops = { .readpage = ocfs2_readpage, - .readpages = ocfs2_readpages, + .readahead = ocfs2_readahead, .writepage = ocfs2_writepage, .write_begin = ocfs2_write_begin, .write_end = ocfs2_write_end,
fs/omfs/file.c renamed from fs/omfs/file.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -289,10 +289,9 @@ static int omfs_readpage(struct file *fireturn block_read_full_page (page, omfs_get_block); } -static int omfs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void omfs_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, omfs_get_block); +mpage_readahead (rac, omfs_get_block); }static int omfs_writepage (struct page *page,struct writeback_control *wbc)
@@ -373,7 +372,7 @@ const struct inode_operations omfs_file_const struct address_space_operations omfs_aops = { .readpage = omfs_readpage, - .readpages = omfs_readpages, + .readahead = omfs_readahead, .writepage = omfs_writepage, .writepages = omfs_writepages, .write_begin = omfs_write_begin,
fs/qnx6/inode.c renamed from fs/qnx6/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -99,10 +99,9 @@ static int qnx6_readpage(struct file *fireturn mpage_readpage (page, qnx6_get_block); } -static int qnx6_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void qnx6_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, qnx6_get_block); +mpage_readahead (rac, qnx6_get_block); }/*
@@ -499,7 +498,7 @@ static sector_t qnx6_bmap(struct address }static const struct address_space_operations qnx6_aops = { .readpage = qnx6_readpage, - .readpages = qnx6_readpages, + .readahead = qnx6_readahead, .bmap = qnx6_bmap };
fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -5
@@ -1160,11 +1160,9 @@ failure:return retval; } -static int -reiserfs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void reiserfs_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, reiserfs_get_block); +mpage_readahead (rac, reiserfs_get_block); }/*
@@ -3434,7 +3432,7 @@ out:const struct address_space_operations reiserfs_address_space_operations = { .writepage = reiserfs_writepage, .readpage = reiserfs_readpage, - .readpages = reiserfs_readpages, + .readahead = reiserfs_readahead, .releasepage = reiserfs_releasepage, .invalidatepage = reiserfs_invalidatepage, .write_begin = reiserfs_write_begin,
fs/udf/inode.c renamed from fs/udf/inode.c~fs-convert-mpage_readpages-to-mpage_readahead +3 -4
@@ -195,10 +195,9 @@ static int udf_readpage(struct file *filreturn mpage_readpage (page, udf_get_block); } -static int udf_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void udf_readahead (struct readahead_control *rac) { -return mpage_readpages (mapping, pages, nr_pages, udf_get_block); +mpage_readahead (rac, udf_get_block); } static int udf_write_begin(struct file *file, struct address_space *mapping,
@@ -234,7 +233,7 @@ static sector_t udf_bmap(struct address_const struct address_space_operations udf_aops = { .readpage = udf_readpage, - .readpages = udf_readpages, + .readahead = udf_readahead, .writepage = udf_writepage, .writepages = udf_writepages, .write_begin = udf_write_begin,
include/linux/mpage.h renamed from include/linux/mpage.h~fs-convert-mpage_readpages-to-mpage_readahead +2 -2
@@ -13,9 +13,9 @@#ifdef CONFIG_BLOCK struct writeback_control ; +struct readahead_control ; -int mpage_readpages (struct address_space *mapping,struct list_head *pages, -unsigned nr_pages,get_block_t get_block); +void mpage_readahead (struct readahead_control *,get_block_t get_block);int mpage_readpage (struct page *page,get_block_t get_block);int mpage_writepages (struct address_space *mapping,struct writeback_control *wbc,get_block_t get_block);
mm/migrate.c renamed from mm/migrate.c~fs-convert-mpage_readpages-to-mpage_readahead +1 -1
@@ -1032,7 +1032,7 @@ static int __unmap_and_move(struct page* to the LRU. Later, when the IO completes the pages are * marked uptodate and unlocked. However, the queueing * could be merging multiple pages for one bio (e.g. -* mpage_readpages). If an allocation happens for the +* mpage_readahead). If an allocation happens for the * second or third page, the process can end up locking * the same page twice and deadlocking. Rather than * trying to be clever about what pages can be locked,
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ btrfs-convert-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: btrfs: convert from readpages to readahead has been added to the -mm tree. Its filename is btrfs-convert-from-readpages-to-readahead.patch
The patch titled
Subject: btrfs: convert from readpages to readahead
has been added to the -mm tree. Its filename is
btrfs-convert-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/btrfs-convert-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/btrfs-convert-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: btrfs: convert from readpages to readahead
Implement the new readahead method in btrfs using the new readahead_page_batch() function.
---
fs/btrfs/extent_io.c | 43 +++++++++++------------------------------ fs/btrfs/extent_io.h | 3 -- fs/btrfs/inode.c | 16 ++++++--------- 3 files changed, 20 insertions(+), 42 deletions(-)
fs/btrfs/extent_io.c renamed from fs/btrfs/extent_io.c~btrfs-convert-from-readpages-to-readahead +12 -31
@@ -4367,51 +4367,32 @@ int extent_writepages(struct address_spareturn ret; } -int extent_readpages (struct address_space *mapping,struct list_head *pages, -unsigned nr_pages) +void extent_readahead (struct readahead_control *rac) {struct bio *bio =NULL ;unsigned long bio_flags =0 ;struct page *pagepool[16 ];struct extent_map *em_cached =NULL ; -int nr =0 ;u64 prev_em_start = (u64)-1 ; +int nr; -while (!list_empty (pages)) { -u64 contig_end =0 ; +while ((nr =readahead_page_batch (rac, pagepool))) { +u64 contig_start =page_offset (pagepool[0 ]); +u64 contig_end =page_offset (pagepool[nr -1 ]) +PAGE_SIZE -1 ; -for (nr =0 ; nr <ARRAY_SIZE (pagepool) && !list_empty (pages);) { -struct page *page =lru_to_page (pages); +ASSERT (contig_start + nr *PAGE_SIZE -1 == contig_end); -prefetchw (&page->flags); -list_del (&page->lru); -if (add_to_page_cache_lru (page, mapping, page->index, -readahead_gfp_mask (mapping))) { -put_page (page); -break ; - } - - pagepool[nr++] = page; - contig_end =page_offset (page) +PAGE_SIZE -1 ; - } - -if (nr) { -u64 contig_start =page_offset (pagepool[0 ]); - -ASSERT (contig_start + nr *PAGE_SIZE -1 == contig_end); - -contiguous_readpages (pagepool, nr, contig_start, - contig_end, &em_cached, &bio, &bio_flags, - &prev_em_start); - } +contiguous_readpages (pagepool, nr, contig_start, contig_end, + &em_cached, &bio, &bio_flags, &prev_em_start); }if (em_cached)free_extent_map (em_cached); -if (bio) -return submit_one_bio (bio,0 , bio_flags); -return 0 ; +if (bio) { +if (submit_one_bio (bio,0 , bio_flags)) +return ; + } }/*
fs/btrfs/extent_io.h renamed from fs/btrfs/extent_io.h~btrfs-convert-from-readpages-to-readahead +1 -2
@@ -198,8 +198,7 @@ int extent_writepages(struct address_spa struct writeback_control *wbc);int btree_write_cache_pages (struct address_space *mapping,struct writeback_control *wbc); -int extent_readpages (struct address_space *mapping,struct list_head *pages, -unsigned nr_pages); +void extent_readahead (struct readahead_control *rac);int extent_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo,__u64 start,__u64 len);void set_page_extent_mapped (struct page *page);
fs/btrfs/inode.c renamed from fs/btrfs/inode.c~btrfs-convert-from-readpages-to-readahead +7 -9
@@ -4856,8 +4856,8 @@ static void evict_inode_truncate_pages(s/* * Keep looping until we have no more ranges in the io tree. -* We can have ongoing bios started by readpages (called from readahead) -* that have their endio callback (extent_io.c:end_bio_extent_readpage) +* We can have ongoing bios started by readahead that have +* their endio callback (extent_io.c:end_bio_extent_readpage) * still in progress (unlocked the pages in the bio but did not yet * unlocked the ranges in the io tree). Therefore this means some * ranges can still be locked and eviction started because before
@@ -7050,11 +7050,11 @@ static int lock_extent_direct(struct ino* for it to complete) and then invalidate the pages for * this range (through invalidate_inode_pages2_range()), * but that can lead us to a deadlock with a concurrent -* call to readpages() (a buffered read or a defrag call +* call to readahead (a buffered read or a defrag call * triggered a readahead) on a page lock due to an * ordered dio extent we created before but did not have * yet a corresponding bio submitted (whence it can not -* complete), which makes readpages() wait for that +* complete), which makes readahead wait for that * ordered extent to complete while holding a lock on * that page. */
@@ -8293,11 +8293,9 @@ static int btrfs_writepages(struct addrereturn extent_writepages (mapping, wbc); } -static int -btrfs_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void btrfs_readahead (struct readahead_control *rac) { -return extent_readpages (mapping, pages, nr_pages); +extent_readahead (rac); }static int __btrfs_releasepage (struct page *page,gfp_t gfp_flags)
@@ -10553,7 +10551,7 @@ static const struct address_space_operat .readpage = btrfs_readpage, .writepage = btrfs_writepage, .writepages = btrfs_writepages, - .readpages = btrfs_readpages, + .readahead = btrfs_readahead, .direct_IO = btrfs_direct_IO, .invalidatepage = btrfs_invalidatepage, .releasepage = btrfs_releasepage,
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ erofs-convert-uncompressed-files-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: erofs: convert uncompressed files from readpages to readahead has been added to the -mm tree. Its filename is…
The patch titled
Subject: erofs: convert uncompressed files from readpages to readahead
has been added to the -mm tree. Its filename is
erofs-convert-uncompressed-files-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/erofs-convert-uncompressed-files-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/erofs-convert-uncompressed-files-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: erofs: convert uncompressed files from readpages to readahead
Use the new readahead operation in erofs
---
fs/erofs/data.c | 41 ++++++++++++--------------------- fs/erofs/zdata.c | 2 - include/trace/events/erofs.h | 6 ++-- 3 files changed, 19 insertions(+), 30 deletions(-)
fs/erofs/data.c renamed from fs/erofs/data.c~erofs-convert-uncompressed-files-from-readpages-to-readahead +15 -26
@@ -280,47 +280,36 @@ static int erofs_raw_access_readpage(strreturn 0 ; } -static int erofs_raw_access_readpages (struct file *filp, -struct address_space *mapping, -struct list_head *pages, -unsigned int nr_pages) +static void erofs_raw_access_readahead (struct readahead_control *rac) {erofs_off_t last_block;struct bio *bio =NULL ; -gfp_t gfp =readahead_gfp_mask (mapping); - struct page *page = list_last_entry(pages, struct page, lru); +struct page *page; -trace_erofs_readpages (mapping->host, page, nr_pages, true); - -for (; nr_pages; --nr_pages) { - page = list_entry(pages->prev, struct page, lru); +trace_erofs_readpages (rac->mapping->host,readahead_index (rac), +readahead_count (rac), true); +while ((page =readahead_page (rac))) {prefetchw (&page->flags); -list_del (&page->lru); -if (!add_to_page_cache_lru (page, mapping, page->index, gfp)) { - bio =erofs_read_raw_page (bio, mapping, page, - &last_block, nr_pages, true); - -/* all the page errors are ignored when readahead */ -if (IS_ERR (bio)) { -pr_err ("%s, readahead error at page %lu of nid %llu\n" , - __func__, page->index, -EROFS_I (mapping->host)->nid); + bio =erofs_read_raw_page (bio, rac->mapping, page, &last_block, +readahead_count (rac), true); + +/* all the page errors are ignored when readahead */ +if (IS_ERR (bio)) { +pr_err ("%s, readahead error at page %lu of nid %llu\n" , + __func__, page->index, +EROFS_I (rac->mapping->host)->nid); - bio =NULL ; - } + bio =NULL ; } -/* pages could still be locked */ put_page (page); } -DBG_BUGON (!list_empty (pages));/* the rare case (end in gaps) */ if (bio)submit_bio (bio); -return 0 ; } static int erofs_get_block(struct inode *inode, sector_t iblock,
@@ -358,7 +347,7 @@ static sector_t erofs_bmap(struct addres/* for uncompressed (aligned) files and raw access for other files */ const struct address_space_operations erofs_raw_access_aops = { .readpage = erofs_raw_access_readpage, - .readpages = erofs_raw_access_readpages, + .readahead = erofs_raw_access_readahead, .bmap = erofs_bmap, };
fs/erofs/zdata.c renamed from fs/erofs/zdata.c~erofs-convert-uncompressed-files-from-readpages-to-readahead +1 -1
@@ -1317,7 +1317,7 @@ static int z_erofs_readpages(struct filestruct page *head =NULL ;LIST_HEAD (pagepool); -trace_erofs_readpages (mapping->host,lru_to_page (pages), +trace_erofs_readpages (mapping->host,lru_to_page (pages)->index, nr_pages, false); f.headoffset = (erofs_off_t )lru_to_page (pages)->index <<PAGE_SHIFT ;
include/trace/events/erofs.h renamed from include/trace/events/erofs.h~erofs-convert-uncompressed-files-from-readpages-to-readahead +3 -3
@@ -113,10 +113,10 @@ TRACE_EVENT(erofs_readpage, TRACE_EVENT(erofs_readpages, - TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage, + TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage, bool raw), - TP_ARGS(inode, page, nrpage, raw), + TP_ARGS(inode, start, nrpage, raw), TP_STRUCT__entry( __field(dev_t, dev )
@@ -129,7 +129,7 @@ TRACE_EVENT(erofs_readpages,TP_fast_assign ( __entry->dev = inode->i_sb->s_dev; __entry->nid =EROFS_I (inode)->nid; - __entry->start = page->index; + __entry->start = start; __entry->nrpage = nrpage; __entry->raw = raw; ),
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ erofs-convert-compressed-files-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: erofs: convert compressed files from readpages to readahead has been added to the -mm tree. Its filename is erofs-convert-compressed-files-from-readpages-to-readahead.patch
The patch titled
Subject: erofs: convert compressed files from readpages to readahead
has been added to the -mm tree. Its filename is
erofs-convert-compressed-files-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/erofs-convert-compressed-files-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/erofs-convert-compressed-files-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: erofs: convert compressed files from readpages to readahead
Use the new readahead operation in erofs.
---
fs/erofs/zdata.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
fs/erofs/zdata.c renamed from fs/erofs/zdata.c~erofs-convert-compressed-files-from-readpages-to-readahead +9 -20
@@ -1305,28 +1305,23 @@ static bool should_decompress_synchronoureturn nr <= sbi->max_sync_decompress_pages; } -static int z_erofs_readpages (struct file *filp,struct address_space *mapping, -struct list_head *pages,unsigned int nr_pages) +static void z_erofs_readahead (struct readahead_control *rac) { -struct inode *const inode = mapping->host; +struct inode *const inode = rac->mapping->host;struct erofs_sb_info *const sbi =EROFS_I_SB (inode); -bool sync =should_decompress_synchronously (sbi, nr_pages); +bool sync =should_decompress_synchronously (sbi,readahead_count (rac));struct z_erofs_decompress_frontend f =DECOMPRESS_FRONTEND_INIT (inode); -gfp_t gfp =mapping_gfp_constraint (mapping,GFP_KERNEL ); -struct page *head =NULL ; +struct page *page, *head =NULL ;LIST_HEAD (pagepool); -trace_erofs_readpages (mapping->host,lru_to_page (pages)->index, - nr_pages, false); +trace_erofs_readpages (inode,readahead_index (rac), +readahead_count (rac), false); - f.headoffset = (erofs_off_t )lru_to_page (pages)->index <<PAGE_SHIFT ; - -for (; nr_pages; --nr_pages) { -struct page *page =lru_to_page (pages); + f.headoffset =readahead_pos (rac); +while ((page =readahead_page (rac))) {prefetchw (&page->flags); -list_del (&page->lru);/* * A pure asynchronous readahead is indicated if
@@ -1335,11 +1330,6 @@ static int z_erofs_readpages(struct file*/ sync &= !(PageReadahead (page) && !head); -if (add_to_page_cache_lru (page, mapping, page->index, gfp)) { -list_add (&page->lru, &pagepool); -continue ; - } -set_page_private (page, (unsigned long )head); head = page; }
@@ -1368,11 +1358,10 @@ static int z_erofs_readpages(struct file/* clean up the remaining free pages */ put_pages_list (&pagepool); -return 0 ; }const struct address_space_operations z_erofs_aops = { .readpage = z_erofs_readpage, - .readpages = z_erofs_readpages, + .readahead = z_erofs_readahead, };
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ ext4-convert-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: ext4: convert from readpages to readahead has been added to the -mm tree. Its filename is ext4-convert-from-readpages-to-readahead.patch
The patch titled
Subject: ext4: convert from readpages to readahead
has been added to the -mm tree. Its filename is
ext4-convert-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ext4-convert-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ext4-convert-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: ext4: convert from readpages to readahead
Use the new readahead operation in ext4
---
fs/ext4/ext4.h | 3 +-- fs/ext4/inode.c | 21 +++++++++------------ fs/ext4/readpage.c | 22 ++++++++-------------- 3 files changed, 18 insertions(+), 28 deletions(-)
fs/ext4/ext4.h renamed from fs/ext4/ext4.h~ext4-convert-from-readpages-to-readahead +1 -2
@@ -3317,8 +3317,7 @@ static inline void ext4_set_de_type(stru/* readpages.c */ extern int ext4_mpage_readpages (struct address_space *mapping, -struct list_head *pages,struct page *page, -unsigned nr_pages,bool is_readahead); +struct readahead_control *rac,struct page *page);extern int __init ext4_init_post_read_processing (void );extern void ext4_exit_post_read_processing (void );
fs/ext4/inode.c renamed from fs/ext4/inode.c~ext4-convert-from-readpages-to-readahead +9 -12
@@ -3224,23 +3224,20 @@ static int ext4_readpage(struct file *fi ret =ext4_readpage_inline (inode, page);if (ret == -EAGAIN ) -return ext4_mpage_readpages (page->mapping,NULL , page,1 , - false); +return ext4_mpage_readpages (page->mapping,NULL , page);return ret; } -static int -ext4_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void ext4_readahead (struct readahead_control *rac) { -struct inode *inode = mapping->host; +struct inode *inode = rac->mapping->host; -/* If the file has inline data, no need to do readpages. */ +/* If the file has inline data, no need to do readahead. */ if (ext4_has_inline_data (inode)) -return 0 ; +return ; -return ext4_mpage_readpages (mapping, pages,NULL , nr_pages, true); +ext4_mpage_readpages (rac->mapping, rac,NULL ); } static void ext4_invalidatepage(struct page *page, unsigned int offset,
@@ -3605,7 +3602,7 @@ static int ext4_set_page_dirty(struct pastatic const struct address_space_operations ext4_aops = { .readpage = ext4_readpage, - .readpages = ext4_readpages, + .readahead = ext4_readahead, .writepage = ext4_writepage, .writepages = ext4_writepages, .write_begin = ext4_write_begin,
@@ -3622,7 +3619,7 @@ static const struct address_space_operatstatic const struct address_space_operations ext4_journalled_aops = { .readpage = ext4_readpage, - .readpages = ext4_readpages, + .readahead = ext4_readahead, .writepage = ext4_writepage, .writepages = ext4_writepages, .write_begin = ext4_write_begin,
@@ -3638,7 +3635,7 @@ static const struct address_space_operatstatic const struct address_space_operations ext4_da_aops = { .readpage = ext4_readpage, - .readpages = ext4_readpages, + .readahead = ext4_readahead, .writepage = ext4_writepage, .writepages = ext4_writepages, .write_begin = ext4_da_write_begin,
fs/ext4/readpage.c renamed from fs/ext4/readpage.c~ext4-convert-from-readpages-to-readahead +8 -14
@@ -7,8 +7,8 @@* * This was originally taken from fs/mpage.c * -* The intent is the ext4_mpage_readpages() function here is intended -* to replace mpage_readpages() in the general case, not just for +* The ext4_mpage_readpages() function here is intended to +* replace mpage_readahead() in the general case, not just for * encrypted files. It has some limitations (see below), where it * will fall back to read_block_full_page(), but these limitations * should only be hit when page_size != block_size.
@@ -222,8 +222,7 @@ static inline loff_t ext4_readpage_limit }int ext4_mpage_readpages (struct address_space *mapping, -struct list_head *pages,struct page *page, -unsigned nr_pages,bool is_readahead) +struct readahead_control *rac,struct page *page) {struct bio *bio =NULL ;sector_t last_block_in_bio =0 ;
@@ -241,6 +240,7 @@ int ext4_mpage_readpages(struct address_int length;unsigned relative_block =0 ;struct ext4_map_blocks map; +unsigned int nr_pages = rac ?readahead_count (rac) :1 ; map.m_pblk =0 ; map.m_lblk =0 ;
@@ -251,14 +251,9 @@ int ext4_mpage_readpages(struct address_int fully_mapped =1 ;unsigned first_hole = blocks_per_page; -if (pages) { - page =lru_to_page (pages); - +if (rac) { + page =readahead_page (rac);prefetchw (&page->flags); -list_del (&page->lru); -if (add_to_page_cache_lru (page, mapping, page->index, -readahead_gfp_mask (mapping))) - goto next_page; }if (page_has_buffers (page))
@@ -381,7 +376,7 @@ int ext4_mpage_readpages(struct address_ bio->bi_iter.bi_sector = blocks[0 ] << (blkbits -9 ); bio->bi_end_io = mpage_end_io;bio_set_op_attrs (bio,REQ_OP_READ , - is_readahead ?REQ_RAHEAD :0 ); + rac ?REQ_RAHEAD :0 ); } length = first_hole << blkbits;
@@ -406,10 +401,9 @@ int ext4_mpage_readpages(struct address_else unlock_page (page); next_page: -if (pages) +if (rac)put_page (page); } -BUG_ON (pages && !list_empty (pages));if (bio)submit_bio (bio);return 0 ;
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ ext4-pass-the-inode-to-ext4_mpage_readpages.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: ext4: pass the inode to ext4_mpage_readpages has been added to the -mm tree. Its filename is ext4-pass-the-inode-to-ext4_mpage_readpages.patch
The patch titled
Subject: ext4: pass the inode to ext4_mpage_readpages
has been added to the -mm tree. Its filename is
ext4-pass-the-inode-to-ext4_mpage_readpages.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ext4-pass-the-inode-to-ext4_mpage_readpages.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ext4-pass-the-inode-to-ext4_mpage_readpages.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: ext4: pass the inode to ext4_mpage_readpages
This function now only uses the mapping argument to look up the inode, and both callers already have the inode, so just pass the inode instead of the mapping.
---
fs/ext4/ext4.h | 2 +- fs/ext4/inode.c | 4 ++-- fs/ext4/readpage.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-)
fs/ext4/ext4.h renamed from fs/ext4/ext4.h~ext4-pass-the-inode-to-ext4_mpage_readpages +1 -1
@@ -3316,7 +3316,7 @@ static inline void ext4_set_de_type(stru }/* readpages.c */ -extern int ext4_mpage_readpages (struct address_space *mapping, +extern int ext4_mpage_readpages (struct inode *inode,struct readahead_control *rac,struct page *page);extern int __init ext4_init_post_read_processing (void );extern void ext4_exit_post_read_processing (void );
fs/ext4/inode.c renamed from fs/ext4/inode.c~ext4-pass-the-inode-to-ext4_mpage_readpages +2 -2
@@ -3224,7 +3224,7 @@ static int ext4_readpage(struct file *fi ret =ext4_readpage_inline (inode, page);if (ret == -EAGAIN ) -return ext4_mpage_readpages (page->mapping,NULL , page); +return ext4_mpage_readpages (inode,NULL , page);return ret; }
@@ -3237,7 +3237,7 @@ static void ext4_readahead(struct readahif (ext4_has_inline_data (inode))return ; -ext4_mpage_readpages (rac->mapping, rac,NULL ); +ext4_mpage_readpages (inode, rac,NULL ); } static void ext4_invalidatepage(struct page *page, unsigned int offset,
fs/ext4/readpage.c renamed from fs/ext4/readpage.c~ext4-pass-the-inode-to-ext4_mpage_readpages +1 -2
@@ -221,13 +221,12 @@ static inline loff_t ext4_readpage_limitreturn i_size_read (inode); } -int ext4_mpage_readpages (struct address_space *mapping, +int ext4_mpage_readpages (struct inode *inode,struct readahead_control *rac,struct page *page) {struct bio *bio =NULL ;sector_t last_block_in_bio =0 ; -struct inode *inode = mapping->host;const unsigned blkbits = inode->i_blkbits;const unsigned blocks_per_page =PAGE_SIZE >> blkbits;const unsigned blocksize =1 << blkbits;
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ f2fs-convert-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: f2fs: convert from readpages to readahead has been added to the -mm tree. Its filename is f2fs-convert-from-readpages-to-readahead.patch
The patch titled
Subject: f2fs: convert from readpages to readahead
has been added to the -mm tree. Its filename is
f2fs-convert-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/f2fs-convert-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/f2fs-convert-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: f2fs: convert from readpages to readahead
Use the new readahead operation in f2fs
---
fs/f2fs/data.c | 47 +++++++++++++--------------------- include/trace/events/f2fs.h | 6 ++-- 2 files changed, 22 insertions(+), 31 deletions(-)
fs/f2fs/data.c renamed from fs/f2fs/data.c~f2fs-convert-from-readpages-to-readahead +19 -28
@@ -2178,8 +2178,7 @@ out:* from read-ahead. */ static int f2fs_mpage_readpages (struct address_space *mapping, -struct list_head *pages,struct page *page, -unsigned nr_pages,bool is_readahead) +struct readahead_control *rac,struct page *page) {struct bio *bio =NULL ;sector_t last_block_in_bio =0 ;
@@ -2197,6 +2196,7 @@ static int f2fs_mpage_readpages(struct a .nr_cpages = 0, };#endif +unsigned nr_pages = rac ?readahead_count (rac) :1 ;unsigned max_nr_pages = nr_pages;int ret =0 ;
@@ -2210,15 +2210,9 @@ static int f2fs_mpage_readpages(struct a map.m_may_create = false;for (; nr_pages; nr_pages--) { -if (pages) { - page = list_last_entry(pages, struct page, lru); - +if (rac) { + page =readahead_page (rac);prefetchw (&page->flags); -list_del (&page->lru); -if (add_to_page_cache_lru (page, mapping, -page_index (page), -readahead_gfp_mask (mapping))) - goto next_page; }#ifdef CONFIG_F2FS_FS_COMPRESSION
@@ -2228,7 +2222,7 @@ static int f2fs_mpage_readpages(struct a ret =f2fs_read_multi_pages (&cc, &bio, max_nr_pages, &last_block_in_bio, - is_readahead, false); + rac !=NULL , false);f2fs_destroy_compress_ctx (&cc);if (ret) goto set_error_page;
@@ -2251,7 +2245,7 @@ read_single_page:#endif ret =f2fs_read_single_page (inode, page, max_nr_pages, &map, - &bio, &last_block_in_bio, is_readahead); + &bio, &last_block_in_bio, rac);if (ret) {#ifdef CONFIG_F2FS_FS_COMPRESSION set_error_page:
@@ -2260,8 +2254,10 @@ set_error_page:zero_user_segment (page,0 ,PAGE_SIZE );unlock_page (page); } +#ifdef CONFIG_F2FS_FS_COMPRESSION next_page: -if (pages) +#endif +if (rac)put_page (page);#ifdef CONFIG_F2FS_FS_COMPRESSION
@@ -2271,16 +2267,15 @@ next_page: ret =f2fs_read_multi_pages (&cc, &bio, max_nr_pages, &last_block_in_bio, - is_readahead, false); + rac !=NULL , false); f2fs_destroy_compress_ctx(&cc); } }#endif } -BUG_ON (pages && !list_empty (pages));if (bio)__submit_bio (F2FS_I_SB (inode), bio,DATA ); -return pages ?0 : ret; +return ret; }static int f2fs_read_data_page (struct file *file,struct page *page)
@@ -2299,28 +2294,24 @@ static int f2fs_read_data_page(struct fiif (f2fs_has_inline_data (inode)) ret =f2fs_read_inline_data (inode, page);if (ret == -EAGAIN ) - ret =f2fs_mpage_readpages (page_file_mapping (page), -NULL , page,1 , false); + ret =f2fs_mpage_readpages (page_file_mapping (page),NULL , page);return ret; } -static int f2fs_read_data_pages (struct file *file, -struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) +static void f2fs_readahead (struct readahead_control *rac) { -struct inode *inode = mapping->host; - struct page *page = list_last_entry(pages, struct page, lru); +struct inode *inode = rac->mapping->host; -trace_f2fs_readpages (inode, page, nr_pages); +trace_f2fs_readpages (inode,readahead_index (rac),readahead_count (rac));if (!f2fs_is_compress_backend_ready (inode)) -return 0 ; +return ;/* If the file has inline data, skip readpages */ if (f2fs_has_inline_data (inode)) -return 0 ; +return ; -return f2fs_mpage_readpages (mapping, pages,NULL , nr_pages, true); +f2fs_mpage_readpages (rac->mapping, rac,NULL ); }int f2fs_encrypt_one_page (struct f2fs_io_info *fio)
@@ -3805,7 +3796,7 @@ static void f2fs_swap_deactivate(structconst struct address_space_operations f2fs_dblock_aops = { .readpage = f2fs_read_data_page, - .readpages = f2fs_read_data_pages, + .readahead = f2fs_readahead, .writepage = f2fs_write_data_page, .writepages = f2fs_write_data_pages, .write_begin = f2fs_write_begin,
include/trace/events/f2fs.h renamed from include/trace/events/f2fs.h~f2fs-convert-from-readpages-to-readahead +3 -3
@@ -1376,9 +1376,9 @@ TRACE_EVENT(f2fs_writepages, TRACE_EVENT(f2fs_readpages, - TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage), + TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage), - TP_ARGS(inode, page, nrpage), + TP_ARGS(inode, start, nrpage), TP_STRUCT__entry( __field(dev_t, dev)
@@ -1390,7 +1390,7 @@ TRACE_EVENT(f2fs_readpages,TP_fast_assign ( __entry->dev = inode->i_sb->s_dev; __entry->ino = inode->i_ino; - __entry->start = page->index; + __entry->start = start; __entry->nrpage = nrpage; ),
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: f2fs: pass the inode to f2fs_mpage_readpages has been added to the -mm tree. Its filename is f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch
The patch titled
Subject: f2fs: pass the inode to f2fs_mpage_readpages
has been added to the -mm tree. Its filename is
f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: f2fs: pass the inode to f2fs_mpage_readpages
This function now only uses the mapping argument to look up the inode, and both callers already have the inode, so just pass the inode instead of the mapping.
---
fs/f2fs/data.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c renamed from fs/f2fs/data.c~f2fs-pass-the-inode-to-f2fs_mpage_readpages +3 -4
@@ -2177,12 +2177,11 @@ out:* use ->readpage() or do the necessary surgery to decouple ->readpages() * from read-ahead. */ -static int f2fs_mpage_readpages (struct address_space *mapping, +static int f2fs_mpage_readpages (struct inode *inode,struct readahead_control *rac,struct page *page) {struct bio *bio =NULL ;sector_t last_block_in_bio =0 ; -struct inode *inode = mapping->host;struct f2fs_map_blocks map;#ifdef CONFIG_F2FS_FS_COMPRESSION struct compress_ctx cc = {
@@ -2294,7 +2293,7 @@ static int f2fs_read_data_page(struct fiif (f2fs_has_inline_data (inode)) ret =f2fs_read_inline_data (inode, page);if (ret == -EAGAIN ) - ret =f2fs_mpage_readpages (page_file_mapping (page),NULL , page); + ret =f2fs_mpage_readpages (inode,NULL , page);return ret; }
@@ -2311,7 +2310,7 @@ static void f2fs_readahead(struct readahif (f2fs_has_inline_data (inode))return ; -f2fs_mpage_readpages (rac->mapping, rac,NULL ); +f2fs_mpage_readpages (inode, rac,NULL ); }int f2fs_encrypt_one_page (struct f2fs_io_info *fio)
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ fuse-convert-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: fuse: convert from readpages to readahead has been added to the -mm tree. Its filename is fuse-convert-from-readpages-to-readahead.patch
The patch titled
Subject: fuse: convert from readpages to readahead
has been added to the -mm tree. Its filename is
fuse-convert-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/fuse-convert-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/fuse-convert-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: fuse: convert from readpages to readahead
Implement the new readahead operation in fuse by using __readahead_batch() to fill the array of pages in fuse_args_pages directly. This lets us inline fuse_readpages_fill() into fuse_readahead().
---
fs/fuse/file.c | 99 ++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 72 deletions(-)
fs/fuse/file.c renamed from fs/fuse/file.c~fuse-convert-from-readpages-to-readahead +27 -72
@@ -915,84 +915,39 @@ static void fuse_send_readpages(struct ffuse_readpages_end (fc, &ap->args, err); } -struct fuse_fill_data { -struct fuse_io_args *ia; -struct file *file; -struct inode *inode; -unsigned int nr_pages; -unsigned int max_pages; -}; - -static int fuse_readpages_fill (void *_data,struct page *page) +static void fuse_readahead (struct readahead_control *rac) { -struct fuse_fill_data *data = _data; -struct fuse_io_args *ia = data->ia; -struct fuse_args_pages *ap = &ia->ap; -struct inode *inode = data->inode; +struct inode *inode = rac->mapping->host;struct fuse_conn *fc =get_fuse_conn (inode); +unsigned int i, max_pages, nr_pages =0 ; -fuse_wait_on_page_writeback (inode, page->index); - -if (ap->num_pages && - (ap->num_pages == fc->max_pages || - (ap->num_pages +1 ) *PAGE_SIZE > fc->max_read || - ap->pages[ap->num_pages -1 ]->index +1 != page->index)) { - data->max_pages = min_t(unsigned int, data->nr_pages, - fc->max_pages); -fuse_send_readpages (ia, data->file); - data->ia = ia =fuse_io_alloc (NULL , data->max_pages); -if (!ia) { -unlock_page (page); -return -ENOMEM ; - } - ap = &ia->ap; - } - -if (WARN_ON (ap->num_pages >= data->max_pages)) { -unlock_page (page); -fuse_io_free (ia); -return -EIO ; - } - -get_page (page); - ap->pages[ap->num_pages] = page; - ap->descs[ap->num_pages].length =PAGE_SIZE ; - ap->num_pages++; - data->nr_pages--; -return 0 ; -} - -static int fuse_readpages (struct file *file,struct address_space *mapping, -struct list_head *pages,unsigned nr_pages) -{ -struct inode *inode = mapping->host; -struct fuse_conn *fc =get_fuse_conn (inode); -struct fuse_fill_data data; -int err; - - err = -EIO ;if (is_bad_inode (inode)) - goto out; +return ; - data.file = file; - data.inode = inode; - data.nr_pages = nr_pages; - data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages); -; - data.ia =fuse_io_alloc (NULL , data.max_pages); - err = -ENOMEM ; -if (!data.ia) - goto out; + max_pages =min (fc->max_pages, fc->max_read /PAGE_SIZE ); - err =read_cache_pages (mapping, pages, fuse_readpages_fill, &data); -if (!err) { -if (data.ia->ap.num_pages) -fuse_send_readpages (data.ia, file); -else -fuse_io_free (data.ia); +for (;;) { +struct fuse_io_args *ia; +struct fuse_args_pages *ap; + + nr_pages =readahead_count (rac) - nr_pages; +if (nr_pages > max_pages) + nr_pages = max_pages; +if (nr_pages ==0 ) +break ; + ia =fuse_io_alloc (NULL , nr_pages); +if (!ia) +return ; + ap = &ia->ap; + nr_pages =__readahead_batch (rac, ap->pages, nr_pages); +for (i =0 ; i < nr_pages; i++) { +fuse_wait_on_page_writeback (inode, +readahead_index (rac) + i); + ap->descs[i].length =PAGE_SIZE ; + } + ap->num_pages = nr_pages; +fuse_send_readpages (ia, rac->file); } -out: -return err; }static ssize_t fuse_cache_read_iter (struct kiocb *iocb,struct iov_iter *to)
@@ -3373,10 +3328,10 @@ static const struct file_operations fusestatic const struct address_space_operations fuse_file_aops = { .readpage = fuse_readpage, + .readahead = fuse_readahead, .writepage = fuse_writepage, .writepages = fuse_writepages, .launder_page = fuse_launder_page, - .readpages = fuse_readpages, .set_page_dirty = __set_page_dirty_nobuffers, .bmap = fuse_bmap, .direct_IO = fuse_direct_IO,
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ iomap-convert-from-readpages-to-readahead.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: iomap: convert from readpages to readahead has been added to the -mm tree. Its filename is iomap-convert-from-readpages-to-readahead.patch
The patch titled
Subject: iomap: convert from readpages to readahead
has been added to the -mm tree. Its filename is
iomap-convert-from-readpages-to-readahead.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/iomap-convert-from-readpages-to-readahead.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/iomap-convert-from-readpages-to-readahead.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: iomap: convert from readpages to readahead
Use the new readahead operation in iomap. Convert XFS and ZoneFS to use it.
---
fs/iomap/buffered-io.c | 92 +++++++++++++-------------------------- fs/iomap/trace.h | 2 fs/xfs/xfs_aops.c | 13 ++--- fs/zonefs/super.c | 7 +- include/linux/iomap.h | 3 - 5 files changed, 42 insertions(+), 75 deletions(-)
fs/iomap/buffered-io.c renamed from fs/iomap/buffered-io.c~iomap-convert-from-readpages-to-readahead +32 -60
@@ -214,9 +214,8 @@ iomap_read_end_io(struct bio *bio)struct iomap_readpage_ctx {struct page *cur_page;bool cur_page_in_bio; -bool is_readahead;struct bio *bio; -struct list_head *pages; +struct readahead_control *rac; }; static void
@@ -308,7 +307,7 @@ iomap_readpage_actor(struct inode *inodeif (ctx->bio)submit_bio (ctx->bio); -if (ctx->is_readahead)/* same as readahead_gfp_mask */ +if (ctx->rac)/* same as readahead_gfp_mask */ gfp |= __GFP_NORETRY | __GFP_NOWARN; ctx->bio =bio_alloc (gfp,min (BIO_MAX_PAGES , nr_vecs));/*
@@ -319,7 +318,7 @@ iomap_readpage_actor(struct inode *inodeif (!ctx->bio) ctx->bio =bio_alloc (orig_gfp,1 ); ctx->bio->bi_opf =REQ_OP_READ ; -if (ctx->is_readahead) +if (ctx->rac) ctx->bio->bi_opf |=REQ_RAHEAD ; ctx->bio->bi_iter.bi_sector = sector;bio_set_dev (ctx->bio, iomap->bdev);
@@ -375,36 +374,8 @@ iomap_readpage(struct page *page, const }EXPORT_SYMBOL_GPL (iomap_readpage); -static struct page * -iomap_next_page (struct inode *inode,struct list_head *pages,loff_t pos, -loff_t length,loff_t *done) -{ -while (!list_empty (pages)) { -struct page *page =lru_to_page (pages); - -if (page_offset (page) >= (u64 )pos + length) -break ; - -list_del (&page->lru); -if (!add_to_page_cache_lru (page, inode->i_mapping, page->index, -GFP_NOFS )) -return page; - -/* -* If we already have a page in the page cache at index we are -* done. Upper layers don't care if it is uptodate after the -* readpages call itself as every page gets checked again once -* actually needed. -*/ - *done +=PAGE_SIZE ; -put_page (page); - } - -return NULL ; -} -static loff_t -iomap_readpages_actor (struct inode *inode,loff_t pos,loff_t length, +iomap_readahead_actor (struct inode *inode,loff_t pos,loff_t length,void *data,struct iomap *iomap,struct iomap *srcmap) {struct iomap_readpage_ctx *ctx = data;
@@ -418,10 +389,7 @@ iomap_readpages_actor(struct inode *inod ctx->cur_page =NULL ; }if (!ctx->cur_page) { - ctx->cur_page =iomap_next_page (inode, ctx->pages, - pos, length, &done); -if (!ctx->cur_page) -break ; + ctx->cur_page =readahead_page (ctx->rac); ctx->cur_page_in_bio = false; } ret = iomap_readpage_actor(inode, pos + done, length - done,
@@ -431,32 +399,43 @@ iomap_readpages_actor(struct inode *inodreturn done; } -int -iomap_readpages (struct address_space *mapping,struct list_head *pages, -unsigned nr_pages,const struct iomap_ops *ops) -{ +/** +* iomap_readahead - Attempt to read pages from a file. +* @rac: Describes the pages to be read. +* @ops: The operations vector for the filesystem. +* +* This function is for filesystems to call to implement their readahead +* address_space operation. +* +* Context: The @ops callbacks may submit I/O (eg to read the addresses of +* blocks from disc), and may wait for it. The caller may be trying to +* access a different page, and so sleeping excessively should be avoided. +* It may allocate memory, but should avoid costly allocations. This +* function is called with memalloc_nofs set, so allocations will not cause +* the filesystem to be reentered. +*/ +void iomap_readahead (struct readahead_control *rac,const struct iomap_ops *ops) +{ +struct inode *inode = rac->mapping->host; +loff_t pos =readahead_pos (rac); +loff_t length =readahead_length (rac);struct iomap_readpage_ctx ctx = { - .pages = pages, - .is_readahead = true, + .rac = rac, }; - loff_t pos = page_offset(list_entry(pages->prev, struct page, lru)); - loff_t last = page_offset(list_entry(pages->next, struct page, lru)); -loff_t length = last - pos +PAGE_SIZE , ret =0 ; -trace_iomap_readpages (mapping->host, nr_pages); +trace_iomap_readahead (inode,readahead_count (rac));while (length >0 ) { - ret =iomap_apply (mapping->host, pos, length,0 , ops, - &ctx, iomap_readpages_actor); +loff_t ret =iomap_apply (inode, pos, length,0 , ops, + &ctx, iomap_readahead_actor);if (ret <=0 ) {WARN_ON_ONCE (ret ==0 ); - goto done; +break ; } pos += ret; length -= ret; } - ret =0 ; -done: +if (ctx.bio)submit_bio (ctx.bio);if (ctx.cur_page) {
@@ -464,15 +443,8 @@ done:unlock_page (ctx.cur_page);put_page (ctx.cur_page); } - -/* -* Check that we didn't lose a page due to the arcance calling -* conventions.. -*/ -WARN_ON_ONCE (!ret && !list_empty (ctx.pages)); -return ret; } -EXPORT_SYMBOL_GPL (iomap_readpages); +EXPORT_SYMBOL_GPL (iomap_readahead);/* * iomap_is_partially_uptodate checks whether blocks within a page are
fs/iomap/trace.h renamed from fs/iomap/trace.h~iomap-convert-from-readpages-to-readahead +1 -1
@@ -39,7 +39,7 @@ DEFINE_EVENT(iomap_readpage_class, name, TP_PROTO(struct inode *inode, int nr_pages), \ TP_ARGS(inode, nr_pages)) DEFINE_READPAGE_EVENT(iomap_readpage); -DEFINE_READPAGE_EVENT (iomap_readpages); +DEFINE_READPAGE_EVENT (iomap_readahead); DECLARE_EVENT_CLASS(iomap_range_class, TP_PROTO(struct inode *inode, unsigned long off, unsigned int len),
fs/xfs/xfs_aops.c renamed from fs/xfs/xfs_aops.c~iomap-convert-from-readpages-to-readahead +5 -8
@@ -621,14 +621,11 @@ xfs_vm_readpage(return iomap_readpage (page, &xfs_read_iomap_ops); } -STATIC int -xfs_vm_readpages ( -struct file *unused, -struct address_space *mapping, -struct list_head *pages, -unsigned nr_pages) +STATIC void +xfs_vm_readahead ( +struct readahead_control *rac) { -return iomap_readpages (mapping, pages, nr_pages, &xfs_read_iomap_ops); +iomap_readahead (rac, &xfs_read_iomap_ops); } static int
@@ -644,7 +641,7 @@ xfs_iomap_swapfile_activate(const struct address_space_operations xfs_address_space_operations = { .readpage = xfs_vm_readpage, - .readpages = xfs_vm_readpages, + .readahead = xfs_vm_readahead, .writepage = xfs_vm_writepage, .writepages = xfs_vm_writepages, .set_page_dirty = iomap_set_page_dirty,
fs/zonefs/super.c renamed from fs/zonefs/super.c~iomap-convert-from-readpages-to-readahead +3 -4
@@ -78,10 +78,9 @@ static int zonefs_readpage(struct file *return iomap_readpage (page, &zonefs_iomap_ops); } -static int zonefs_readpages (struct file *unused,struct address_space *mapping, -struct list_head *pages,unsigned int nr_pages) +static void zonefs_readahead (struct readahead_control *rac) { -return iomap_readpages (mapping, pages, nr_pages, &zonefs_iomap_ops); +iomap_readahead (rac, &zonefs_iomap_ops); }/*
@@ -128,7 +127,7 @@ static int zonefs_writepages(struct addrstatic const struct address_space_operations zonefs_file_aops = { .readpage = zonefs_readpage, - .readpages = zonefs_readpages, + .readahead = zonefs_readahead, .writepage = zonefs_writepage, .writepages = zonefs_writepages, .set_page_dirty = iomap_set_page_dirty,
include/linux/iomap.h renamed from include/linux/iomap.h~iomap-convert-from-readpages-to-readahead +1 -2
@@ -155,8 +155,7 @@ loff_t iomap_apply(struct inode *inode,ssize_t iomap_file_buffered_write (struct kiocb *iocb,struct iov_iter *from,const struct iomap_ops *ops);int iomap_readpage (struct page *page,const struct iomap_ops *ops); -int iomap_readpages (struct address_space *mapping,struct list_head *pages, -unsigned nr_pages,const struct iomap_ops *ops); +void iomap_readahead (struct readahead_control *,const struct iomap_ops *ops);int iomap_set_page_dirty (struct page *page);int iomap_is_partially_uptodate (struct page *page,unsigned long from,unsigned long count);
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch iomap-convert-from-readpages-to-readahead.patch
+ mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
has been added to the -mm tree. Its filename is
mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
find_mergeable_vma can return NULL. In this case, it leads to crash when we access vma->vm_mm(its offset is 0x40) later in write_protect_page. And this case did happen on our server. The following calltrace is captured in kernel 4.19 with the following patch applied and KSM zero page enabled on our server.
commit e86c59b1b12d ("mm/ksm: improve deduplication of zero pages with colouring")
So add a vma check to fix it.
--------------------------------------------------------------------------
BUG: unable to handle kernel NULL pointer dereference at 0000000000000040
Oops: 0000 [#1] SMP NOPTI
CPU: 9 PID: 510 Comm: ksmd Kdump: loaded Tainted: G OE 4.19.36.bsk.9-amd64 #4.19.36.bsk.9
Hardware name: FOXCONN R-5111/GROOT, BIOS IC1B111F 08/17/2019
RIP: 0010:try_to_merge_one_page+0xc7/0x760
Code: 24 58 65 48 33 34 25 28 00 00 00 89 e8 0f 85 a3 06 00 00 48 83 c4
60 5b 5d 41 5c 41 5d 41 5e 41 5f c3 48 8b 46 08 a8 01 75 b8 <49>
8b 44 24 40 4c 8d 7c 24 20 b9 07 00 00 00 4c 89 e6 4c 89 ff 48
RSP: 0018:ffffadbdd9fffdb0 EFLAGS: 00010246
RAX: ffffda83ffd4be08 RBX: ffffda83ffd4be40 RCX: 0000002c6e800000
RDX: 0000000000000000 RSI: ffffda83ffd4be40 RDI: 0000000000000000
RBP: ffffa11939f02ec0 R08: 0000000094e1a447 R09: 00000000abe76577
R10: 0000000000000962 R11: 0000000000004e6a R12: 0000000000000000
R13: ffffda83b1e06380 R14: ffffa18f31f072c0 R15: ffffda83ffd4be40
FS: 0000000000000000(0000) GS:ffffa0da43b80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000040 CR3: 0000002c77c0a003 CR4: 00000000007626e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
? follow_page_pte+0x36d/0x5e0
ksm_scan_thread+0x115e/0x1960
? remove_wait_queue+0x60/0x60
kthread+0xf5/0x130
? try_to_merge_with_ksm_page+0x90/0x90
? kthread_create_worker_on_cpu+0x70/0x70
ret_from_fork+0x1f/0x30
-----------------------------------------------------------------------------
mm/ksm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +5 -2
@@ -2112,8 +2112,11 @@ static void cmp_and_merge_page(struct padown_read (&mm->mmap_sem); vma =find_mergeable_vma (mm, rmap_item->address); - err =try_to_merge_one_page (vma, page, -ZERO_PAGE (rmap_item->address)); +if (vma) + err =try_to_merge_one_page (vma, page, +ZERO_PAGE (rmap_item->address)); +else + err = -EFAULT ;up_read (&mm->mmap_sem);/* * In case of failure, the page was not really empty, so we
_
Patches currently in -mm which might be from [email protected] are
mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
Kirill Tkhai
Reviewed-byRe: + mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch added to -mm tree
Quoted 67 lines · Andrew Morton
The patch titled
Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
has been added to the -mm tree. Its filename is
mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patchThis patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patchBefore you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's*** Remember to use
Documentation/process/submit-checklist.rstwhen testing your code ***The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
find_mergeable_vmacan return NULL. In this case, it leads to crash when we accessvma->vm_mm(its offset is 0x40)later inwrite_protect_page. And this case did happen on our server. The following calltrace is captured in kernel 4.19 with the following patch applied and KSM zero page enabled on our server.commit
e86c59b1b12d("mm/ksm: improve deduplication of zero pages with colouring")So add a vma check to fix it.
--------------------------------------------------------------------------
BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 Oops: 0000 [#1] SMP NOPTI CPU: 9 PID: 510 Comm: ksmd Kdump: loaded Tainted: G OE 4.19.36.bsk.9-amd64 #4.19.36.bsk.9 Hardware name: FOXCONN R-5111/GROOT, BIOS IC1B111F 08/17/2019 RIP: 0010:try_to_merge_one_page+0xc7/0x760 Code: 24 58 65 48 33 34 25 28 00 00 00 89 e8 0f 85 a3 06 00 00 48 83 c4 60 5b 5d 41 5c 41 5d 41 5e 41 5f c3 48 8b 46 08 a8 01 75 b8 <49> 8b 44 24 40 4c 8d 7c 24 20 b9 07 00 00 00 4c 89 e6 4c 89 ff 48 RSP: 0018:ffffadbdd9fffdb0 EFLAGS: 00010246 RAX: ffffda83ffd4be08 RBX: ffffda83ffd4be40 RCX: 0000002c6e800000 RDX: 0000000000000000 RSI: ffffda83ffd4be40 RDI: 0000000000000000 RBP: ffffa11939f02ec0 R08: 0000000094e1a447 R09: 00000000abe76577 R10: 0000000000000962 R11: 0000000000004e6a R12: 0000000000000000 R13: ffffda83b1e06380 R14: ffffa18f31f072c0 R15: ffffda83ffd4be40 FS: 0000000000000000(0000) GS:ffffa0da43b80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000040 CR3: 0000002c77c0a003 CR4: 00000000007626e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: ? follow_page_pte+0x36d/0x5e0 ksm_scan_thread+0x115e/0x1960 ? remove_wait_queue+0x60/0x60 kthread+0xf5/0x130 ? try_to_merge_with_ksm_page+0x90/0x90 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x1f/0x30 --------------------------------------------------------------------------
Quoted 5 lines
Fixes e86c59b1b12d ("mm/ksm: improve deduplication of zero pages with colouring")Signed-off-by Muchun Song <[email protected]>Co-developed-by Xiongchun Duan <[email protected]>Reviewed-by David Hildenbrand <[email protected]>
Quoted 15 lines
Cc Hugh Dickins <[email protected]>Cc Yang Shi <[email protected]>Cc Claudio Imbrenda <[email protected]>Cc Markus Elfring <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
mm/ksm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +0
-0@@ -2112,8 +2112,11 @@ static void cmp_and_merge_page(struct pa
mm/ksm.c static void cmp_and_merge_page(struct pa · line 2120
Quoted 10 lines
mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +5
-2down_read (&mm->mmap_sem); vma =find_mergeable_vma (mm, rmap_item->address); - err =try_to_merge_one_page (vma, page, -ZERO_PAGE (rmap_item->address)); +if (vma) + err =try_to_merge_one_page (vma, page, +ZERO_PAGE (rmap_item->address)); +else + err = -EFAULT ;up_read (&mm->mmap_sem);
In case of vma is out of date, we also may consider to exit this function without calling unstable_tree_search_insert().
Quoted 8 lines
mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +0
-0/* * In case of failure, the page was not really empty, so we _
Patches currently in -mm which might be from [email protected] are
mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
Re: [External] Re: + mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch added to -mm tree
Quoted 92 lines · Kirill Tkhai
Quoted 67 lines · Andrew Morton
The patch titled
Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
has been added to the -mm tree. Its filename is
mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patchThis patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patchBefore you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's*** Remember to use
Documentation/process/submit-checklist.rstwhen testing your code ***The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
find_mergeable_vmacan return NULL. In this case, it leads to crash when we accessvma->vm_mm(its offset is 0x40)later inwrite_protect_page. And this case did happen on our server. The following calltrace is captured in kernel 4.19 with the following patch applied and KSM zero page enabled on our server.commit
e86c59b1b12d("mm/ksm: improve deduplication of zero pages with colouring")So add a vma check to fix it.
--------------------------------------------------------------------------
BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 Oops: 0000 [#1] SMP NOPTI CPU: 9 PID: 510 Comm: ksmd Kdump: loaded Tainted: G OE 4.19.36.bsk.9-amd64 #4.19.36.bsk.9 Hardware name: FOXCONN R-5111/GROOT, BIOS IC1B111F 08/17/2019 RIP: 0010:try_to_merge_one_page+0xc7/0x760 Code: 24 58 65 48 33 34 25 28 00 00 00 89 e8 0f 85 a3 06 00 00 48 83 c4 60 5b 5d 41 5c 41 5d 41 5e 41 5f c3 48 8b 46 08 a8 01 75 b8 <49> 8b 44 24 40 4c 8d 7c 24 20 b9 07 00 00 00 4c 89 e6 4c 89 ff 48 RSP: 0018:ffffadbdd9fffdb0 EFLAGS: 00010246 RAX: ffffda83ffd4be08 RBX: ffffda83ffd4be40 RCX: 0000002c6e800000 RDX: 0000000000000000 RSI: ffffda83ffd4be40 RDI: 0000000000000000 RBP: ffffa11939f02ec0 R08: 0000000094e1a447 R09: 00000000abe76577 R10: 0000000000000962 R11: 0000000000004e6a R12: 0000000000000000 R13: ffffda83b1e06380 R14: ffffa18f31f072c0 R15: ffffda83ffd4be40 FS: 0000000000000000(0000) GS:ffffa0da43b80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000040 CR3: 0000002c77c0a003 CR4: 00000000007626e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: ? follow_page_pte+0x36d/0x5e0 ksm_scan_thread+0x115e/0x1960 ? remove_wait_queue+0x60/0x60 kthread+0xf5/0x130 ? try_to_merge_with_ksm_page+0x90/0x90 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x1f/0x30 --------------------------------------------------------------------------Quoted 5 lines
Fixes e86c59b1b12d ("mm/ksm: improve deduplication of zero pages with colouring")Signed-off-by Muchun Song <[email protected]>Co-developed-by Xiongchun Duan <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Kirill Tkhai <[email protected]>Quoted 15 lines
Cc Hugh Dickins <[email protected]>Cc Yang Shi <[email protected]>Cc Claudio Imbrenda <[email protected]>Cc Markus Elfring <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
mm/ksm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +0
-0@@ -2112,8 +2112,11 @@ static void cmp_and_merge_page(struct pa
Quoted 13 lines
mm/ksm.c static void cmp_and_merge_page(struct pa · line 2120
Quoted 10 lines
mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +5
-2down_read (&mm->mmap_sem); vma =find_mergeable_vma (mm, rmap_item->address); - err =try_to_merge_one_page (vma, page, -ZERO_PAGE (rmap_item->address)); +if (vma) + err =try_to_merge_one_page (vma, page, +ZERO_PAGE (rmap_item->address)); +else + err = -EFAULT ;up_read (&mm->mmap_sem);In case of vma is out of date, we also may consider to exit this function without calling
unstable_tree_search_insert().
Yeah, I agree with you. Should I send another patch to fix this patch or an upgraded
version(v4) of this patch.
Quoted 10 lines
Quoted 9 lines
mm/ksm.c renamed from mm/ksm.c~mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled +0
-0/* * In case of failure, the page was not really empty, so we _
Patches currently in -mm which might be from [email protected] are
mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch
Signature · 2 lines
Yours, Muchun
Andrew Morton
maintainerRe: [External] Re: + mm-ksm-fix-null-pointer-dereference-when-ksm-zero-page-is-enabled.patch added to -mm tree
Quoted 6 lines · On Wed, 15 Apr 2020 16:16:50 +0800 Muchun Song <[email protected]> wrote:
Quoted 2 lines
In case of vma is out of date, we also may consider to exit this function without calling
unstable_tree_search_insert().Yeah, I agree with you. Should I send another patch to fix this patch or an upgraded
version(v4) of this patch.
Either is OK.
+ mm-gupc-further-document-vma_permits_fault.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm/gup.c: further document vma_permits_fault() has been added to the -mm tree. Its filename is mm-gupc-further-document-vma_permits_fault.patch
The patch titled
Subject: mm/gup.c: further document vma_permits_fault()
has been added to the -mm tree. Its filename is
mm-gupc-further-document-vma_permits_fault.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-gupc-further-document-vma_permits_fault.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-gupc-further-document-vma_permits_fault.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Miles Chen <[email protected]>
Subject: mm/gup.c: further document vma_permits_fault()
---
mm/gup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/gup.c renamed from mm/gup.c~mm-gupc-further-document-vma_permits_fault +2 -1
@@ -1176,7 +1176,8 @@ static bool vma_permits_fault(struct vm_* @address: user address * @fault_flags:flags to pass down to handle_mm_fault() * @unlocked: did we unlock the mmap_sem while retrying, maybe NULL if caller -* does not allow retry +* does not allow retry. If NULL, the caller must guarantee +* that fault_flags does not contain FAULT_FLAG_ALLOW_RETRY. * * This is meant to be called in the specific scenario where for locking reasons * we try to access user memory in atomic context (within a pagefault_disable()
_
Patches currently in -mm which might be from [email protected] are
mm-gupc-further-document-vma_permits_fault.patch
+ fuse-convert-from-readpages-to-readahead-fix.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: fuse-convert-from-readpages-to-readahead-fix has been added to the -mm tree. Its filename is fuse-convert-from-readpages-to-readahead-fix.patch
The patch titled
Subject: fuse-convert-from-readpages-to-readahead-fix
has been added to the -mm tree. Its filename is
fuse-convert-from-readpages-to-readahead-fix.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/fuse-convert-from-readpages-to-readahead-fix.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/fuse-convert-from-readpages-to-readahead-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Matthew Wilcox <[email protected]>
Subject: fuse-convert-from-readpages-to-readahead-fix
build fix
---
fs/fuse/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/file.c renamed from fs/fuse/file.c~fuse-convert-from-readpages-to-readahead-fix +2 -1
@@ -924,7 +924,8 @@ static void fuse_readahead(struct readahif (is_bad_inode (inode))return ; - max_pages =min (fc->max_pages, fc->max_read /PAGE_SIZE ); + max_pages = min_t(unsigned int, fc->max_pages, + fc->max_read /PAGE_SIZE );for (;;) {struct fuse_io_args *ia;
_
Patches currently in -mm which might be from [email protected] are
mm-move-readahead-prototypes-from-mmh.patch mm-return-void-from-various-readahead-functions.patch mm-ignore-return-value-of-readpages.patch mm-move-readahead-nr_pages-check-into-read_pages.patch mm-add-new-readahead_control-api.patch mm-use-readahead_control-to-pass-arguments.patch mm-rename-various-offset-parameters-to-index.patch mm-rename-readahead-loop-variable-to-i.patch mm-remove-page_offset-from-readahead-loop.patch mm-put-readahead-pages-in-cache-earlier.patch mm-add-readahead-address-space-operation.patch mm-move-end_index-check-out-of-readahead-loop.patch mm-add-page_cache_readahead_unbounded.patch mm-document-why-we-dont-set-pagereadahead.patch mm-use-memalloc_nofs_save-in-readahead-path.patch fs-convert-mpage_readpages-to-mpage_readahead.patch btrfs-convert-from-readpages-to-readahead.patch erofs-convert-uncompressed-files-from-readpages-to-readahead.patch erofs-convert-compressed-files-from-readpages-to-readahead.patch ext4-convert-from-readpages-to-readahead.patch ext4-pass-the-inode-to-ext4_mpage_readpages.patch f2fs-convert-from-readpages-to-readahead.patch f2fs-pass-the-inode-to-f2fs_mpage_readpages.patch fuse-convert-from-readpages-to-readahead.patch fuse-convert-from-readpages-to-readahead-fix.patch iomap-convert-from-readpages-to-readahead.patch
+ x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: x86/hyperv: use vmalloc_exec for the hypercall page has been added to the -mm tree. Its filename is x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch
The patch titled
Subject: x86/hyperv: use vmalloc_exec for the hypercall page
has been added to the -mm tree. Its filename is
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: x86/hyperv: use vmalloc_exec for the hypercall page
Patch series "decruft the vmalloc API", v2.
Peter noticed that with some dumb luck you can toast the kernel address space with exported vmalloc symbols.
I used this as an opportunity to decruft the vmalloc.c API and make it much more systematic. This also removes any chance to create vmalloc mappings outside the designated areas or using executable permissions from modules. Besides that it removes more than 300 lines of code.
This patch (of 29):
Use the designated helper for allocating executable kernel memory, and remove the now unused PAGE_KERNEL_RX define.
---
arch/x86/hyperv/hv_init.c | 2 +- arch/x86/include/asm/pgtable_types.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/x86/hyperv/hv_init.c renamed from arch/x86/hyperv/hv_init.c~x86-hyperv-use-vmalloc_exec-for-the-hypercall-page +1 -1
@@ -356,7 +356,7 @@ void __init hyperv_init(void) guest_id =generate_guest_id (0 ,LINUX_VERSION_CODE ,0 );wrmsrl (HV_X64_MSR_GUEST_OS_ID , guest_id); - hv_hypercall_pg =__vmalloc (PAGE_SIZE ,GFP_KERNEL ,PAGE_KERNEL_RX ); + hv_hypercall_pg =vmalloc_exec (PAGE_SIZE );if (hv_hypercall_pg ==NULL ) {wrmsrl (HV_X64_MSR_GUEST_OS_ID ,0 ); goto remove_cpuhp_state;
arch/x86/include/asm/pgtable_types.h renamed from arch/x86/include/asm/pgtable_types.h~x86-hyperv-use-vmalloc_exec-for-the-hypercall-page +0 -2
@@ -194,7 +194,6 @@ enum page_cache_mode {#define _PAGE_TABLE_NOENC (__PP|__RW|_USR|___A| 0|___D| 0| 0)#define _PAGE_TABLE (__PP|__RW|_USR|___A| 0|___D| 0| 0| _ENC)#define __PAGE_KERNEL_RO (__PP| 0| 0|___A|__NX|___D| 0|___G) -#define __PAGE_KERNEL_RX (__PP| 0| 0|___A| 0|___D| 0|___G)#define __PAGE_KERNEL_NOCACHE (__PP|__RW| 0|___A|__NX|___D| 0|___G| __NC)#define __PAGE_KERNEL_VVAR (__PP| 0|_USR|___A|__NX|___D| 0|___G)#define __PAGE_KERNEL_LARGE (__PP|__RW| 0|___A|__NX|___D|_PSE|___G)
@@ -220,7 +219,6 @@ enum page_cache_mode {#define PAGE_KERNEL_RO __pgprot_mask(__PAGE_KERNEL_RO | _ENC)#define PAGE_KERNEL_EXEC __pgprot_mask(__PAGE_KERNEL_EXEC | _ENC)#define PAGE_KERNEL_EXEC_NOENC __pgprot_mask(__PAGE_KERNEL_EXEC | 0) -#define PAGE_KERNEL_RX __pgprot_mask(__PAGE_KERNEL_RX | _ENC)#define PAGE_KERNEL_NOCACHE __pgprot_mask(__PAGE_KERNEL_NOCACHE | _ENC)#define PAGE_KERNEL_LARGE __pgprot_mask(__PAGE_KERNEL_LARGE | _ENC)#define PAGE_KERNEL_LARGE_EXEC __pgprot_mask(__PAGE_KERNEL_LARGE_EXEC | _ENC)
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ x86-fix-vmap-arguments-in-map_irq_stack.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: x86: fix vmap arguments in map_irq_stack has been added to the -mm tree. Its filename is x86-fix-vmap-arguments-in-map_irq_stack.patch
The patch titled
Subject: x86: fix vmap arguments in map_irq_stack
has been added to the -mm tree. Its filename is
x86-fix-vmap-arguments-in-map_irq_stack.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/x86-fix-vmap-arguments-in-map_irq_stack.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/x86-fix-vmap-arguments-in-map_irq_stack.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: x86: fix vmap arguments in map_irq_stack
vmap does not take a gfp_t, the flags argument is for VM_* flags.
---
arch/x86/kernel/irq_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/irq_64.c renamed from arch/x86/kernel/irq_64.c~x86-fix-vmap-arguments-in-map_irq_stack +1 -1
@@ -43,7 +43,7 @@ static int map_irq_stack(unsigned int cp pages[i] =pfn_to_page (pa >>PAGE_SHIFT ); } - va =vmap (pages,IRQ_STACK_SIZE /PAGE_SIZE ,GFP_KERNEL ,PAGE_KERNEL ); + va =vmap (pages,IRQ_STACK_SIZE /PAGE_SIZE ,VM_MAP ,PAGE_KERNEL );if (!va)return -ENOMEM ;
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ staging-android-ion-use-vmap-instead-of-vm_map_ram.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: staging: android: ion: use vmap instead of vm_map_ram has been added to the -mm tree. Its filename is staging-android-ion-use-vmap-instead-of-vm_map_ram.patch
The patch titled
Subject: staging: android: ion: use vmap instead of vm_map_ram
has been added to the -mm tree. Its filename is
staging-android-ion-use-vmap-instead-of-vm_map_ram.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/staging-android-ion-use-vmap-instead-of-vm_map_ram.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/staging-android-ion-use-vmap-instead-of-vm_map_ram.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: staging: android: ion: use vmap instead of vm_map_ram
vm_map_ram can keep mappings around after the vm_unmap_ram. Using that with non-PAGE_KERNEL mappings can lead to all kinds of aliasing issues.
---
drivers/staging/android/ion/ion_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion_heap.c renamed from drivers/staging/android/ion/ion_heap.c~staging-android-ion-use-vmap-instead-of-vm_map_ram +2 -2
@@ -99,12 +99,12 @@ int ion_heap_map_user(struct ion_heap *hstatic int ion_heap_clear_pages (struct page **pages,int num,pgprot_t pgprot) { -void *addr =vm_map_ram (pages, num,-1 , pgprot); +void *addr =vmap (pages, num,VM_MAP , pgprot);if (!addr)return -ENOMEM ;memset (addr,0 ,PAGE_SIZE * num); -vm_unmap_ram (addr, num); +vunmap (addr);return 0 ; }
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: staging: media: ipu3: use vmap instead of reimplementing it has been added to the -mm tree. Its filename is staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch
The patch titled
Subject: staging: media: ipu3: use vmap instead of reimplementing it
has been added to the -mm tree. Its filename is
staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: staging: media: ipu3: use vmap instead of reimplementing it
Just use vmap instead of messing with vmalloc internals.
---
drivers/staging/media/ipu3/ipu3-css-pool.h | 4 -- drivers/staging/media/ipu3/ipu3-dmamap.c | 30 +++++-------------- 2 files changed, 9 insertions(+), 25 deletions(-)
drivers/staging/media/ipu3/ipu3-css-pool.h renamed from drivers/staging/media/ipu3/ipu3-css-pool.h~staging-media-ipu3-use-vmap-instead-of-reimplementing-it +1 -3
@@ -15,14 +15,12 @@ struct imgu_device;* @size: size of the buffer in bytes. * @vaddr: kernel virtual address. * @daddr: iova dma address to access IPU3. -* @vma: private, a pointer to &struct vm_struct, -* used for imgu_dmamap_free. */ struct imgu_css_map {size_t size;void *vaddr;dma_addr_t daddr; -struct vm_struct *vma; +struct page **pages; };/**
drivers/staging/media/ipu3/ipu3-dmamap.c renamed from drivers/staging/media/ipu3/ipu3-dmamap.c~staging-media-ipu3-use-vmap-instead-of-reimplementing-it +8 -22
@@ -96,6 +96,7 @@ void *imgu_dmamap_alloc(struct imgu_deviunsigned long shift =iova_shift (&imgu->iova_domain);struct device *dev = &imgu->pci_dev->dev;size_t size =PAGE_ALIGN (len); +int count = size >>PAGE_SHIFT ;struct page **pages;dma_addr_t iovaddr;struct iova *iova;
@@ -114,7 +115,7 @@ void *imgu_dmamap_alloc(struct imgu_devi/* Call IOMMU driver to setup pgt */ iovaddr =iova_dma_addr (&imgu->iova_domain, iova); -for (i =0 ; i < size /PAGE_SIZE ; ++i) { +for (i =0 ; i < count; ++i) { rval =imgu_mmu_map (imgu->mmu, iovaddr,page_to_phys (pages[i]),PAGE_SIZE );if (rval)
@@ -123,33 +124,23 @@ void *imgu_dmamap_alloc(struct imgu_devi iovaddr +=PAGE_SIZE ; } -/* Now grab a virtual region */ - map->vma =__get_vm_area (size,VM_USERMAP ,VMALLOC_START ,VMALLOC_END ); -if (!map->vma) + map->vaddr =vmap (pages, count,VM_USERMAP ,PAGE_KERNEL ); +if (!map->vaddr) goto out_unmap; - map->vma->pages = pages; -/* And map it in KVA */ -if (map_vm_area (map->vma,PAGE_KERNEL , pages)) - goto out_vunmap; - + map->pages = pages; map->size = size; map->daddr =iova_dma_addr (&imgu->iova_domain, iova); - map->vaddr = map->vma->addr;dev_dbg (dev,"%s: allocated %zu @ IOVA %pad @ VA %p\n" , __func__, - size, &map->daddr, map->vma->addr); - -return map->vma->addr; + size, &map->daddr, map->vaddr); -out_vunmap: -vunmap (map->vma->addr); +return map->vaddr; out_unmap:imgu_dmamap_free_buffer (pages, size);imgu_mmu_unmap (imgu->mmu,iova_dma_addr (&imgu->iova_domain, iova), i *PAGE_SIZE ); - map->vma =NULL ; out_free_iova:__free_iova (&imgu->iova_domain, iova);
@@ -177,8 +168,6 @@ void imgu_dmamap_unmap(struct imgu_devic*/ void imgu_dmamap_free (struct imgu_device *imgu,struct imgu_css_map *map) { -struct vm_struct *area = map->vma; -dev_dbg (&imgu->pci_dev->dev,"%s: freeing %zu @ IOVA %pad @ VA %p\n" , __func__, map->size, &map->daddr, map->vaddr);
@@ -187,11 +176,8 @@ void imgu_dmamap_free(struct imgu_deviceimgu_dmamap_unmap (imgu, map); -if (WARN_ON (!area) ||WARN_ON (!area->pages)) -return ; - -imgu_dmamap_free_buffer (area->pages, map->size);vunmap (map->vaddr); +imgu_dmamap_free_buffer (map->pages, map->size); map->vaddr =NULL ; }
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ dma-mapping-use-vmap-insted-of-reimplementing-it.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: dma-mapping: use vmap insted of reimplementing it has been added to the -mm tree. Its filename is dma-mapping-use-vmap-insted-of-reimplementing-it.patch
The patch titled
Subject: dma-mapping: use vmap insted of reimplementing it
has been added to the -mm tree. Its filename is
dma-mapping-use-vmap-insted-of-reimplementing-it.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/dma-mapping-use-vmap-insted-of-reimplementing-it.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/dma-mapping-use-vmap-insted-of-reimplementing-it.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: dma-mapping: use vmap insted of reimplementing it
Replace the open coded instance of vmap with the actual function. In the non-contiguous (IOMMU) case this requires an extra find_vm_area, but given that this isn't a fast path function that is a small price to pay.
---
kernel/dma/remap.c | 48 ++++++++++--------------------------------- 1 file changed, 12 insertions(+), 36 deletions(-)
kernel/dma/remap.c renamed from kernel/dma/remap.c~dma-mapping-use-vmap-insted-of-reimplementing-it +12 -36
@@ -20,23 +20,6 @@ struct page **dma_common_find_pages(voidreturn area->pages; } -static struct vm_struct *__dma_common_pages_remap (struct page **pages, -size_t size,pgprot_t prot,const void *caller) -{ -struct vm_struct *area; - - area =get_vm_area_caller (size,VM_DMA_COHERENT , caller); -if (!area) -return NULL ; - -if (map_vm_area (area, prot, pages)) { -vunmap (area->addr); -return NULL ; - } - -return area; -} -/* * Remaps an array of PAGE_SIZE pages into another vm_area. * Cannot be used in non-sleeping contexts
@@ -44,15 +27,12 @@ static struct vm_struct *__dma_common_pavoid *dma_common_pages_remap (struct page **pages,size_t size,pgprot_t prot,const void *caller) { -struct vm_struct *area; +void *vaddr; - area =__dma_common_pages_remap (pages, size, prot, caller); -if (!area) -return NULL ; - - area->pages = pages; - -return area->addr; + vaddr =vmap (pages, size >>PAGE_SHIFT ,VM_DMA_COHERENT , prot); +if (vaddr) +find_vm_area (vaddr)->pages = pages; +return vaddr; }/*
@@ -62,24 +42,20 @@ void *dma_common_pages_remap(struct pagevoid *dma_common_contiguous_remap (struct page *page,size_t size,pgprot_t prot,const void *caller) { -int i; +int count = size >>PAGE_SHIFT ;struct page **pages; -struct vm_struct *area; +void *vaddr; +int i; - pages =kmalloc (sizeof (struct page *) <<get_order (size),GFP_KERNEL ); + pages =kmalloc_array (count,sizeof (struct page *),GFP_KERNEL );if (!pages)return NULL ; - -for (i =0 ; i < (size >>PAGE_SHIFT ); i++) +for (i =0 ; i < count; i++) pages[i] =nth_page (page, i); - - area =__dma_common_pages_remap (pages, size, prot, caller); - + vaddr =vmap (pages, count,VM_DMA_COHERENT , prot);kfree (pages); -if (!area) -return NULL ; -return area->addr; +return vaddr; }/*
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ powerpc-add-an-ioremap_phb-helper.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: powerpc: add an ioremap_phb helper has been added to the -mm tree. Its filename is powerpc-add-an-ioremap_phb-helper.patch
The patch titled
Subject: powerpc: add an ioremap_phb helper
has been added to the -mm tree. Its filename is
powerpc-add-an-ioremap_phb-helper.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/powerpc-add-an-ioremap_phb-helper.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/powerpc-add-an-ioremap_phb-helper.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: powerpc: add an ioremap_phb helper
Factor code shared between pci_64 and electra_cf into a ioremap_pbh helper that follows the normal ioremap semantics, and returns a useful __iomem pointer. Note that it opencodes __ioremap_at as we know from the callers the slab is available. Switch pci_64 to also store the result as __iomem pointer, and unmap the result using iounmap instead of force casting and using vmalloc APIs.
---
arch/powerpc/include/asm/io.h | 2 arch/powerpc/include/asm/pci-bridge.h | 2 arch/powerpc/kernel/pci_64.c | 53 +++++++++++++++--------- drivers/pcmcia/electra_cf.c | 45 +++++++------------- 4 files changed, 54 insertions(+), 48 deletions(-)
arch/powerpc/include/asm/io.h renamed from arch/powerpc/include/asm/io.h~powerpc-add-an-ioremap_phb-helper +2 -0
@@ -719,6 +719,8 @@ void __iomem *ioremap_coherent(phys_addrextern void iounmap (volatile void __iomem *addr); +void __iomem *ioremap_phb (phys_addr_t paddr,unsigned long size); +int early_ioremap_range (unsigned long ea,phys_addr_t pa,unsigned long size,pgprot_t prot); void __iomem *do_ioremap(phys_addr_t pa, phys_addr_t offset, unsigned long size,
arch/powerpc/include/asm/pci-bridge.h renamed from arch/powerpc/include/asm/pci-bridge.h~powerpc-add-an-ioremap_phb-helper +1 -1
@@ -66,7 +66,7 @@ struct pci_controller {void __iomem *io_base_virt;#ifdef CONFIG_PPC64 -void *io_base_alloc; +void __iomem *io_base_alloc;#endif resource_size_t io_base_phys;resource_size_t pci_io_size;
arch/powerpc/kernel/pci_64.c renamed from arch/powerpc/kernel/pci_64.c~powerpc-add-an-ioremap_phb-helper +35 -18
81 lines not on this page · raw message
drivers/pcmcia/electra_cf.c renamed from drivers/pcmcia/electra_cf.c~powerpc-add-an-ioremap_phb-helper +16 -29
77 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ powerpc-remove-__ioremap_at-and-__iounmap_at.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: powerpc: remove __ioremap_at and __iounmap_at has been added to the -mm tree. Its filename is powerpc-remove-__ioremap_at-and-__iounmap_at.patch
The patch titled
Subject: powerpc: remove __ioremap_at and __iounmap_at
has been added to the -mm tree. Its filename is
powerpc-remove-__ioremap_at-and-__iounmap_at.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/powerpc-remove-__ioremap_at-and-__iounmap_at.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/powerpc-remove-__ioremap_at-and-__iounmap_at.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: powerpc: remove __ioremap_at and __iounmap_at
These helpers are only used for remapping the ISA I/O base. Replace the mapping side with a remap_isa_range helper in isa-bridge.c that hard codes all the known arguments, and just remove __iounmap_at in favour of open coding it in the only caller.
---
arch/powerpc/include/asm/io.h | 8 ---- arch/powerpc/kernel/isa-bridge.c | 28 ++++++++++++---- arch/powerpc/mm/ioremap_64.c | 50 ----------------------------- 3 files changed, 21 insertions(+), 65 deletions(-)
arch/powerpc/include/asm/io.h renamed from arch/powerpc/include/asm/io.h~powerpc-remove-__ioremap_at-and-__iounmap_at +0 -8
@@ -699,10 +699,6 @@ static inline void iosync(void)* * * iounmap undoes such a mapping and can be hooked * -* * __ioremap_at (and the pending __iounmap_at) are low level functions to -* create hand-made mappings for use only by the PCI code and cannot -* currently be hooked. Must be page aligned. -* * * __ioremap_caller is the same as above but takes an explicit caller * reference rather than using __builtin_return_address(0) *
@@ -729,10 +725,6 @@ void __iomem *do_ioremap(phys_addr_t pa,extern void __iomem *__ioremap_caller (phys_addr_t ,unsigned long size,pgprot_t prot,void *caller); -extern void __iomem *__ioremap_at (phys_addr_t pa,void *ea, -unsigned long size,pgprot_t prot); -extern void __iounmap_at (void *ea,unsigned long size); -/* * When CONFIG_PPC_INDIRECT_PIO is set, we use the generic iomap implementation * which needs some additional definitions here. They basically allow PIO
arch/powerpc/kernel/isa-bridge.c renamed from arch/powerpc/kernel/isa-bridge.c~powerpc-remove-__ioremap_at-and-__iounmap_at +21 -7
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/mm.h> #include <linux/notifier.h> +#include <linux/vmalloc.h> #include <asm/processor.h> #include <asm/io.h>
@@ -38,6 +39,22 @@ EXPORT_SYMBOL_GPL(isa_bridge_pcidev);#define ISA_SPACE_MASK 0x1#define ISA_SPACE_IO 0x1 +static void remap_isa_base (phys_addr_t pa,unsigned long size) +{ +WARN_ON_ONCE (ISA_IO_BASE & ~PAGE_MASK ); +WARN_ON_ONCE (pa & ~PAGE_MASK ); +WARN_ON_ONCE (size & ~PAGE_MASK ); + +if (slab_is_available ()) { +if (ioremap_page_range (ISA_IO_BASE ,ISA_IO_BASE + size, pa, +pgprot_noncached (PAGE_KERNEL ))) +unmap_kernel_range (ISA_IO_BASE , size); + }else { +early_ioremap_range (ISA_IO_BASE , pa, size, +pgprot_noncached (PAGE_KERNEL )); + } +} +static void pci_process_ISA_OF_ranges (struct device_node *isa_node,unsigned long phb_io_base_phys) {
@@ -105,15 +122,13 @@ static void pci_process_ISA_OF_ranges(stif (size >0x10000 ) size =0x10000 ; -__ioremap_at (phb_io_base_phys, (void *)ISA_IO_BASE , - size,pgprot_noncached (PAGE_KERNEL )); +remap_isa_base (phb_io_base_phys, size);return ; inval_range:printk (KERN_ERR "no ISA IO ranges or unexpected isa range, " "mapping 64k\n" ); -__ioremap_at (phb_io_base_phys, (void *)ISA_IO_BASE , -0x10000 ,pgprot_noncached (PAGE_KERNEL )); +remap_isa_base (phb_io_base_phys,0x10000 ); }
@@ -248,8 +263,7 @@ void __init isa_bridge_init_non_pci(stru* and map it */ isa_io_base =ISA_IO_BASE ; -__ioremap_at (pbase, (void *)ISA_IO_BASE , - size,pgprot_noncached (PAGE_KERNEL )); +remap_isa_base (pbase, size);pr_debug ("ISA: Non-PCI bridge is %pOF\n" , np); }
@@ -297,7 +311,7 @@ static void isa_bridge_remove(void) isa_bridge_pcidev =NULL ;/* Unmap the ISA area */ -__iounmap_at ((void *)ISA_IO_BASE ,0x10000 ); +unmap_kernel_range (ISA_IO_BASE ,0x10000 ); }/**
arch/powerpc/mm/ioremap_64.c renamed from arch/powerpc/mm/ioremap_64.c~powerpc-remove-__ioremap_at-and-__iounmap_at +0 -50
56 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-__get_vm_area.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove __get_vm_area has been added to the -mm tree. Its filename is mm-remove-__get_vm_area.patch
The patch titled
Subject: mm: remove __get_vm_area
has been added to the -mm tree. Its filename is
mm-remove-__get_vm_area.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-__get_vm_area.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-__get_vm_area.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove __get_vm_area
Switch the two remaining callers to use __get_vm_area_caller instead.
---
arch/powerpc/kernel/pci_64.c | 3 ++- arch/sh/kernel/cpu/sh4/sq.c | 3 ++- include/linux/vmalloc.h | 2 -- mm/vmalloc.c | 8 -------- 4 files changed, 4 insertions(+), 12 deletions(-)
arch/powerpc/kernel/pci_64.c renamed from arch/powerpc/kernel/pci_64.c~mm-remove-__get_vm_area +2 -1
@@ -132,7 +132,8 @@ void __iomem *ioremap_phb(phys_addr_t pa* address decoding but I'd rather not deal with those outside of the * reserved 64K legacy region. */ - area =__get_vm_area (size,0 ,PHB_IO_BASE ,PHB_IO_END ); + area =__get_vm_area_caller (size,0 ,PHB_IO_BASE ,PHB_IO_END , +__builtin_return_address (0 ));if (!area)return NULL ;
arch/sh/kernel/cpu/sh4/sq.c renamed from arch/sh/kernel/cpu/sh4/sq.c~mm-remove-__get_vm_area +2 -1
@@ -103,7 +103,8 @@ static int __sq_remap(struct sq_mapping#if defined(CONFIG_MMU )struct vm_struct *vma; - vma =__get_vm_area (map->size,VM_ALLOC , map->sq_addr,SQ_ADDRMAX ); + vma =__get_vm_area_caller (map->size,VM_ALLOC , map->sq_addr, +SQ_ADDRMAX ,__builtin_return_address (0 ));if (!vma)return -ENOMEM ;
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-__get_vm_area +0 -2
@@ -161,8 +161,6 @@ static inline size_t get_vm_area_size(coextern struct vm_struct *get_vm_area (unsigned long size,unsigned long flags);extern struct vm_struct *get_vm_area_caller (unsigned long size,unsigned long flags,const void *caller); -extern struct vm_struct *__get_vm_area (unsigned long size,unsigned long flags, -unsigned long start,unsigned long end); extern struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags, unsigned long start, unsigned long end,
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-__get_vm_area +0 -8
@@ -2127,14 +2127,6 @@ static struct vm_struct *__get_vm_area_nreturn area; } -struct vm_struct *__get_vm_area (unsigned long size,unsigned long flags, -unsigned long start,unsigned long end) -{ -return __get_vm_area_node (size,1 , flags, start, end,NUMA_NO_NODE , -GFP_KERNEL ,__builtin_return_address (0 )); -} -EXPORT_SYMBOL_GPL (__get_vm_area); -struct vm_struct *__get_vm_area_caller (unsigned long size,unsigned long flags,unsigned long start,unsigned long end,const void *caller)
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-unexport-unmap_kernel_range_noflush.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: unexport unmap_kernel_range_noflush has been added to the -mm tree. Its filename is mm-unexport-unmap_kernel_range_noflush.patch
The patch titled
Subject: mm: unexport unmap_kernel_range_noflush
has been added to the -mm tree. Its filename is
mm-unexport-unmap_kernel_range_noflush.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-unexport-unmap_kernel_range_noflush.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-unexport-unmap_kernel_range_noflush.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: unexport unmap_kernel_range_noflush
There are no modular users of this function.
---
mm/vmalloc.c | 1 - 1 file changed, 1 deletion(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-unexport-unmap_kernel_range_noflush +0 -1
@@ -2029,7 +2029,6 @@ void unmap_kernel_range_noflush(unsigned {vunmap_page_range (addr, addr + size); } -EXPORT_SYMBOL_GPL (unmap_kernel_range_noflush);/** * unmap_kernel_range - unmap kernel VM area and flush cache and TLB
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: rename CONFIG_PGTABLE_MAPPING to CONFIG_ZSMALLOC_PGTABLE_MAPPING has been added to the -mm tree. Its filename is…
The patch titled
Subject: mm: rename CONFIG_PGTABLE_MAPPING to CONFIG_ZSMALLOC_PGTABLE_MAPPING
has been added to the -mm tree. Its filename is
mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: rename CONFIG_PGTABLE_MAPPING to CONFIG_ZSMALLOC_PGTABLE_MAPPING
Rename the Kconfig variable to clarify the scope.
---
arch/arm/configs/omap2plus_defconfig | 2 +- include/linux/zsmalloc.h | 2 +- mm/Kconfig | 2 +- mm/zsmalloc.c | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/configs/omap2plus_defconfig renamed from arch/arm/configs/omap2plus_defconfig~mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping +1 -1
@@ -81,7 +81,7 @@ CONFIG_PARTITION_ADVANCED=y CONFIG_BINFMT_MISC=y CONFIG_CMA=y CONFIG_ZSMALLOC=m -CONFIG_PGTABLE_MAPPING=y +CONFIG_ZSMALLOC_PGTABLE_MAPPING=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y
include/linux/zsmalloc.h renamed from include/linux/zsmalloc.h~mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping +1 -1
@@ -20,7 +20,7 @@* zsmalloc mapping modes * * NOTE: These only make a difference when a mapped object spans pages. -* They also have no effect when PGTABLE_MAPPING is selected. +* They also have no effect when ZSMALLOC_PGTABLE_MAPPING is selected. */ enum zs_mapmode {ZS_MM_RW ,/* normal read-write mapping */
mm/Kconfig renamed from mm/Kconfig~mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping +1 -1
@@ -705,7 +705,7 @@ config ZSMALLOC returned by an alloc(). This handle must be mapped in order to access the allocated space. -config PGTABLE_MAPPING +config ZSMALLOC_PGTABLE_MAPPING bool "Use page table mapping to access object in zsmalloc" depends on ZSMALLOC help
mm/zsmalloc.c renamed from mm/zsmalloc.c~mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping +4 -4
@@ -293,7 +293,7 @@ struct zspage { };struct mapping_area { -#ifdef CONFIG_PGTABLE_MAPPING +#ifdef CONFIG_ZSMALLOC_PGTABLE_MAPPING struct vm_struct *vm;/* vm area for mapping object that span pages */ #else char *vm_buf;/* copy buffer for objects that span pages */
@@ -1113,7 +1113,7 @@ static struct zspage *find_get_zspage(streturn zspage; } -#ifdef CONFIG_PGTABLE_MAPPING +#ifdef CONFIG_ZSMALLOC_PGTABLE_MAPPING static inline int __zs_cpu_up (struct mapping_area *area) {/*
@@ -1151,7 +1151,7 @@ static inline void __zs_unmap_object(str unmap_kernel_range(addr, PAGE_SIZE * 2); } -#else /* CONFIG_PGTABLE_MAPPING */ +#else /* CONFIG_ZSMALLOC_PGTABLE_MAPPING */ static inline int __zs_cpu_up (struct mapping_area *area) {
@@ -1233,7 +1233,7 @@ out: pagefault_enable(); } -#endif /* CONFIG_PGTABLE_MAPPING */ +#endif /* CONFIG_ZSMALLOC_PGTABLE_MAPPING */ static int zs_cpu_prepare (unsigned int cpu) {
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: only allow page table mappings for built-in zsmalloc has been added to the -mm tree. Its filename is mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch
The patch titled
Subject: mm: only allow page table mappings for built-in zsmalloc
has been added to the -mm tree. Its filename is
mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: only allow page table mappings for built-in zsmalloc
This allows to unexport map_vm_area and unmap_kernel_range, which are rather deep internal and should not be available to modules, as they for example allow fine grained control of mapping permissions, and also allow splitting the setup of a vmalloc area and the actual mapping and thus expose vmalloc internals.
zsmalloc is typically built-in and continues to work (just like the percpu-vm code using a similar patter), while modular zsmalloc also continues to work, but must use copies.
---
mm/Kconfig | 2 +- mm/vmalloc.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
mm/Kconfig renamed from mm/Kconfig~mm-only-allow-page-table-mappings-for-built-in-zsmalloc +1 -1
@@ -707,7 +707,7 @@ config ZSMALLOC config ZSMALLOC_PGTABLE_MAPPING bool "Use page table mapping to access object in zsmalloc" - depends on ZSMALLOC + depends on ZSMALLOC=y help By default, zsmalloc uses a copy-based object mapping method to access allocations that span two pages. However, if a particular
mm/vmalloc.c renamed from mm/vmalloc.c~mm-only-allow-page-table-mappings-for-built-in-zsmalloc +0 -2
@@ -2046,7 +2046,6 @@ void unmap_kernel_range(unsigned long advunmap_page_range (addr, end);flush_tlb_kernel_range (addr, end); } -EXPORT_SYMBOL_GPL (unmap_kernel_range);int map_vm_area (struct vm_struct *area,pgprot_t prot,struct page **pages) {
@@ -2058,7 +2057,6 @@ int map_vm_area(struct vm_struct *area,return err >0 ?0 : err; } -EXPORT_SYMBOL_GPL (map_vm_area);static inline void setup_vmalloc_vm_locked (struct vm_struct *vm,struct vmap_area *va,unsigned long flags,const void *caller)
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-pass-addr-as-unsigned-long-to-vb_free.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: pass addr as unsigned long to vb_free has been added to the -mm tree. Its filename is mm-pass-addr-as-unsigned-long-to-vb_free.patch
The patch titled
Subject: mm: pass addr as unsigned long to vb_free
has been added to the -mm tree. Its filename is
mm-pass-addr-as-unsigned-long-to-vb_free.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-pass-addr-as-unsigned-long-to-vb_free.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-pass-addr-as-unsigned-long-to-vb_free.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: pass addr as unsigned long to vb_free
Ever use of addr in vb_free casts to unsigned long first, and the caller has an unsigned long version of the address available anyway. Just pass that and avoid all the casts.
---
mm/vmalloc.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-pass-addr-as-unsigned-long-to-vb_free +7 -9
@@ -1664,7 +1664,7 @@ static void *vb_alloc(unsigned long sizereturn vaddr; } -static void vb_free (const void *addr,unsigned long size) +static void vb_free (unsigned long addr,unsigned long size) {unsigned long offset;unsigned long vb_idx;
@@ -1674,24 +1674,22 @@ static void vb_free(const void *addr, unBUG_ON (offset_in_page (size));BUG_ON (size >PAGE_SIZE *VMAP_MAX_ALLOC ); -flush_cache_vunmap ((unsigned long )addr, (unsigned long )addr + size); +flush_cache_vunmap (addr, addr + size); order =get_order (size); - offset = (unsigned long )addr & (VMAP_BLOCK_SIZE -1 ); - offset >>=PAGE_SHIFT ; + offset = (addr & (VMAP_BLOCK_SIZE -1 )) >>PAGE_SHIFT ; - vb_idx =addr_to_vb_idx ((unsigned long )addr); + vb_idx =addr_to_vb_idx (addr);rcu_read_lock (); vb =radix_tree_lookup (&vmap_block_tree, vb_idx);rcu_read_unlock ();BUG_ON (!vb); -vunmap_page_range ((unsigned long )addr, (unsigned long )addr + size); +vunmap_page_range (addr, addr + size);if (debug_pagealloc_enabled_static ()) -flush_tlb_kernel_range ((unsigned long )addr, - (unsigned long )addr + size); +flush_tlb_kernel_range (addr, addr + size);spin_lock (&vb->lock);
@@ -1791,7 +1789,7 @@ void vm_unmap_ram(const void *mem, unsigif (likely (count <=VMAP_MAX_ALLOC )) {debug_check_no_locks_freed (mem, size); -vb_free (mem, size); +vb_free (addr, size);return ; }
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove vmap_page_range_noflush and vunmap_page_range has been added to the -mm tree. Its filename is mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch
The patch titled
Subject: mm: remove vmap_page_range_noflush and vunmap_page_range
has been added to the -mm tree. Its filename is
mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove vmap_page_range_noflush and vunmap_page_range
These have non-static aliases called map_kernel_range_noflush and unmap_kernel_range_noflush that just differ slightly in the calling conventions that pass addr + size instead of an end.
---
mm/vmalloc.c | 98 ++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 58 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-vmap_page_range_noflush-and-vunmap_page_range +40 -58
@@ -127,10 +127,24 @@ static void vunmap_p4d_range(pgd_t *pgd, }while (p4d++, addr = next, addr != end); } -static void vunmap_page_range (unsigned long addr,unsigned long end) +/** +* unmap_kernel_range_noflush - unmap kernel VM area +* @addr: start of the VM area to unmap +* @size: size of the VM area to unmap +* +* Unmap PFN_UP(@size) pages at @addr. The VM area @addr and @size specify +* should have been allocated using get_vm_area() and its friends. +* +* NOTE: +* This function does NOT do any cache flushing. The caller is responsible +* for calling flush_cache_vunmap() on to-be-mapped areas before calling this +* function and flush_tlb_kernel_range() after. +*/ +void unmap_kernel_range_noflush (unsigned long addr,unsigned long size) { -pgd_t *pgd; +unsigned long end = addr + size;unsigned long next; +pgd_t *pgd;BUG_ON (addr >= end); pgd =pgd_offset_k (addr);
@@ -219,18 +233,30 @@ static int vmap_p4d_range(pgd_t *pgd, unreturn 0 ; } -/* -* Set up page tables in kva (addr, end). The ptes shall have prot "prot", and -* will have pfns corresponding to the "pages" array. +/** +* map_kernel_range_noflush - map kernel VM area with the specified pages +* @addr: start of the VM area to map +* @size: size of the VM area to map +* @prot: page protection flags to use +* @pages: pages to map * -* Ie. pte at addr+N*PAGE_SIZE shall point to pfn corresponding to pages[N] +* Map PFN_UP(@size) pages at @addr. The VM area @addr and @size specify should +* have been allocated using get_vm_area() and its friends. +* +* NOTE: +* This function does NOT do any cache flushing. The caller is responsible for +* calling flush_cache_vmap() on to-be-mapped areas before calling this +* function. +* +* RETURNS: +* The number of pages mapped on success, -errno on failure. */ -static int vmap_page_range_noflush (unsigned long start,unsigned long end, -pgprot_t prot,struct page **pages) +int map_kernel_range_noflush (unsigned long addr,unsigned long size, +pgprot_t prot,struct page **pages) { -pgd_t *pgd; +unsigned long end = addr + size;unsigned long next; -unsigned long addr = start; +pgd_t *pgd;int err =0 ;int nr =0 ;
@@ -251,7 +277,7 @@ static int vmap_page_range(unsigned long {int ret; - ret =vmap_page_range_noflush (start, end, prot, pages); + ret =map_kernel_range_noflush (start, end - start, prot, pages);flush_cache_vmap (start, end);return ret; }
@@ -1226,7 +1252,7 @@ EXPORT_SYMBOL_GPL(unregister_vmap_purge_*/ static void unmap_vmap_area (struct vmap_area *va) { -vunmap_page_range (va->va_start, va->va_end); +unmap_kernel_range_noflush (va->va_start, va->va_end - va->va_start); }/*
@@ -1686,7 +1712,7 @@ static void vb_free(unsigned long addr,rcu_read_unlock ();BUG_ON (!vb); -vunmap_page_range (addr, addr + size); +unmap_kernel_range_noflush (addr, size);if (debug_pagealloc_enabled_static ())flush_tlb_kernel_range (addr, addr + size);
@@ -1985,50 +2011,6 @@ void __init vmalloc_init(void) }/** -* map_kernel_range_noflush - map kernel VM area with the specified pages -* @addr: start of the VM area to map -* @size: size of the VM area to map -* @prot: page protection flags to use -* @pages: pages to map -* -* Map PFN_UP(@size) pages at @addr. The VM area @addr and @size -* specify should have been allocated using get_vm_area() and its -* friends. -* -* NOTE: -* This function does NOT do any cache flushing. The caller is -* responsible for calling flush_cache_vmap() on to-be-mapped areas -* before calling this function. -* -* RETURNS: -* The number of pages mapped on success, -errno on failure. -*/ -int map_kernel_range_noflush (unsigned long addr,unsigned long size, -pgprot_t prot,struct page **pages) -{ -return vmap_page_range_noflush (addr, addr + size, prot, pages); -} - -/** -* unmap_kernel_range_noflush - unmap kernel VM area -* @addr: start of the VM area to unmap -* @size: size of the VM area to unmap -* -* Unmap PFN_UP(@size) pages at @addr. The VM area @addr and @size -* specify should have been allocated using get_vm_area() and its -* friends. -* -* NOTE: -* This function does NOT do any cache flushing. The caller is -* responsible for calling flush_cache_vunmap() on to-be-mapped areas -* before calling this function and flush_tlb_kernel_range() after. -*/ -void unmap_kernel_range_noflush (unsigned long addr,unsigned long size) -{ -vunmap_page_range (addr, addr + size); -} - -/** * unmap_kernel_range - unmap kernel VM area and flush cache and TLB * @addr: start of the VM area to unmap * @size: size of the VM area to unmap
@@ -2041,7 +2023,7 @@ void unmap_kernel_range(unsigned long adunsigned long end = addr + size;flush_cache_vunmap (addr, end); -vunmap_page_range (addr, end); +unmap_kernel_range_noflush (addr, size);flush_tlb_kernel_range (addr, end); }
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-rename-vmap_page_range-to-map_kernel_range.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: rename vmap_page_range to map_kernel_range has been added to the -mm tree. Its filename is mm-rename-vmap_page_range-to-map_kernel_range.patch
The patch titled
Subject: mm: rename vmap_page_range to map_kernel_range
has been added to the -mm tree. Its filename is
mm-rename-vmap_page_range-to-map_kernel_range.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-rename-vmap_page_range-to-map_kernel_range.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-rename-vmap_page_range-to-map_kernel_range.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: rename vmap_page_range to map_kernel_range
This matches the map_kernel_range_noflush API. Also change to pass a size instead of the end, similar to the noflush version.
---
mm/vmalloc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-rename-vmap_page_range-to-map_kernel_range +5 -6
@@ -272,13 +272,13 @@ int map_kernel_range_noflush(unsigned loreturn nr; } -static int vmap_page_range (unsigned long start,unsigned long end, +static int map_kernel_range (unsigned long start,unsigned long size,pgprot_t prot,struct page **pages) {int ret; - ret =map_kernel_range_noflush (start, end - start, prot, pages); -flush_cache_vmap (start, end); + ret =map_kernel_range_noflush (start, size, prot, pages); +flush_cache_vmap (start, start + size);return ret; }
@@ -1866,7 +1866,7 @@ void *vm_map_ram(struct page **pages, unkasan_unpoison_vmalloc (mem, size); -if (vmap_page_range (addr, addr + size, prot, pages) <0 ) { +if (map_kernel_range (addr, size, prot, pages) <0 ) {vm_unmap_ram (mem, count);return NULL ; }
@@ -2030,10 +2030,9 @@ void unmap_kernel_range(unsigned long adint map_vm_area (struct vm_struct *area,pgprot_t prot,struct page **pages) {unsigned long addr = (unsigned long )area->addr; -unsigned long end = addr +get_vm_area_size (area);int err; - err =vmap_page_range (addr, end, prot, pages); + err =map_kernel_range (addr,get_vm_area_size (area), prot, pages);return err >0 ?0 : err; }
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch added to -mm tree
In reply to Andrew MortonThe patch titled
The patch titled
Subject: mm: don't return the number of pages from map_kernel_range{,_noflush}has been added to the -mm tree. Its filename is
mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: don't return the number of pages from map_kernel_range{,_noflush}
None of the callers needs the number of pages, and a 0 / -errno return value is a lot more intuitive.
---
mm/vmalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush +2 -2
@@ -249,7 +249,7 @@ static int vmap_p4d_range(pgd_t *pgd, un* function. * * RETURNS: -* The number of pages mapped on success, -errno on failure. +* 0 on success, -errno on failure. */ int map_kernel_range_noflush (unsigned long addr,unsigned long size,pgprot_t prot,struct page **pages)
@@ -269,7 +269,7 @@ int map_kernel_range_noflush(unsigned loreturn err; }while (pgd++, addr = next, addr != end); -return nr; +return 0 ; } static int map_kernel_range(unsigned long start, unsigned long size,
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-map_vm_range.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove map_vm_range has been added to the -mm tree. Its filename is mm-remove-map_vm_range.patch
The patch titled
Subject: mm: remove map_vm_range
has been added to the -mm tree. Its filename is
mm-remove-map_vm_range.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-map_vm_range.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-map_vm_range.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove map_vm_range
Switch all callers to map_kernel_range, which symmetric to the unmap side (as well as the _noflush versions).
---
Documentation/core-api/cachetlb.rst | 2 +- include/linux/vmalloc.h | 10 ++++------ mm/vmalloc.c | 21 +++++++-------------- mm/zsmalloc.c | 4 +++- net/ceph/ceph_common.c | 3 +-- 5 files changed, 16 insertions(+), 24 deletions(-)
Documentation/core-api/cachetlb.rst renamed from Documentation/core-api/cachetlb.rst~mm-remove-map_vm_range +1 -1
@@ -213,7 +213,7 @@ Here are the routines, one by one: there will be no entries in the cache for the kernel address space for virtual addresses in the range 'start' to 'end-1'. - The first of these two routines is invoked after map_vm_area() + The first of these two routines is invoked after map_kernel_range() has installed the page table entries. The second is invoked before unmap_kernel_range() deletes the page table entries.
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-map_vm_range +4 -6
@@ -168,11 +168,11 @@ extern struct vm_struct *__get_vm_area_cextern struct vm_struct *remove_vm_area (const void *addr);extern struct vm_struct *find_vm_area (const void *addr); -extern int map_vm_area (struct vm_struct *area,pgprot_t prot, -struct page **pages);#ifdef CONFIG_MMU extern int map_kernel_range_noflush (unsigned long start,unsigned long size,pgprot_t prot,struct page **pages); +int map_kernel_range (unsigned long start,unsigned long size,pgprot_t prot, +struct page **pages);extern void unmap_kernel_range_noflush (unsigned long addr,unsigned long size);extern void unmap_kernel_range (unsigned long addr,unsigned long size);static inline void set_vm_flush_reset_perms (void *addr)
@@ -189,14 +189,12 @@ map_kernel_range_noflush(unsigned long s {return size >>PAGE_SHIFT ; } +#define map_kernel_range map_kernel_range_noflushstatic inline void unmap_kernel_range_noflush (unsigned long addr,unsigned long size) { } -static inline void -unmap_kernel_range (unsigned long addr,unsigned long size) -{ -} +#define unmap_kernel_range unmap_kernel_range_noflushstatic inline void set_vm_flush_reset_perms (void *addr) { }
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-map_vm_range +7 -14
@@ -272,8 +272,8 @@ int map_kernel_range_noflush(unsigned loreturn 0 ; } -static int map_kernel_range (unsigned long start,unsigned long size, -pgprot_t prot,struct page **pages) +int map_kernel_range (unsigned long start,unsigned long size,pgprot_t prot, +struct page **pages) {int ret;
@@ -2027,16 +2027,6 @@ void unmap_kernel_range(unsigned long adflush_tlb_kernel_range (addr, end); } -int map_vm_area (struct vm_struct *area,pgprot_t prot,struct page **pages) -{ -unsigned long addr = (unsigned long )area->addr; -int err; - - err =map_kernel_range (addr,get_vm_area_size (area), prot, pages); - -return err >0 ?0 : err; -} -static inline void setup_vmalloc_vm_locked (struct vm_struct *vm,struct vmap_area *va,unsigned long flags,const void *caller) {
@@ -2408,7 +2398,8 @@ void *vmap(struct page **pages, unsignedif (!area)return NULL ; -if (map_vm_area (area, prot, pages)) { +if (map_kernel_range ((unsigned long )area->addr, size, prot, + pages) <0 ) {vunmap (area->addr);return NULL ; }
@@ -2471,8 +2462,10 @@ static void *__vmalloc_area_node(struct }atomic_long_add (area->nr_pages, &nr_vmalloc_pages); -if (map_vm_area (area, prot, pages)) +if (map_kernel_range ((unsigned long )area->addr,get_vm_area_size (area), + prot, pages) <0 ) goto fail; +return area->addr; fail:
mm/zsmalloc.c renamed from mm/zsmalloc.c~mm-remove-map_vm_range +3 -1
@@ -1138,7 +1138,9 @@ static inline void __zs_cpu_down(structstatic inline void *__zs_map_object (struct mapping_area *area,struct page *pages[2 ],int off,int size) { -BUG_ON (map_vm_area (area->vm,PAGE_KERNEL , pages)); +unsigned long addr = (unsigned long )area->vm->addr; + +BUG_ON (map_kernel_range (addr,PAGE_SIZE *2 ,PAGE_KERNEL , pages) <0 ); area->vm_addr = area->vm->addr;return area->vm_addr + off; }
net/ceph/ceph_common.c renamed from net/ceph/ceph_common.c~mm-remove-map_vm_range +1 -2
@@ -190,8 +190,7 @@ EXPORT_SYMBOL(ceph_compare_options);* kvmalloc() doesn't fall back to the vmalloc allocator unless flags are * compatible with (a superset of) GFP_KERNEL. This is because while the * actual pages are allocated with the specified flags, the page table pages -* are always allocated with GFP_KERNEL. map_vm_area() doesn't even take -* flags because GFP_KERNEL is hard-coded in {p4d,pud,pmd,pte}_alloc(). +* are always allocated with GFP_KERNEL. * * ceph_kvmalloc() may be called with GFP_KERNEL, GFP_NOFS or GFP_NOIO. */
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-unmap_vmap_area.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove unmap_vmap_area has been added to the -mm tree. Its filename is mm-remove-unmap_vmap_area.patch
The patch titled
Subject: mm: remove unmap_vmap_area
has been added to the -mm tree. Its filename is
mm-remove-unmap_vmap_area.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-unmap_vmap_area.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-unmap_vmap_area.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove unmap_vmap_area
This function just has a single caller, open code it there.
---
mm/vmalloc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-unmap_vmap_area +1 -9
@@ -1248,14 +1248,6 @@ int unregister_vmap_purge_notifier(strucEXPORT_SYMBOL_GPL (unregister_vmap_purge_notifier);/* -* Clear the pagetable entries of a given vmap_area -*/ -static void unmap_vmap_area (struct vmap_area *va) -{ -unmap_kernel_range_noflush (va->va_start, va->va_end - va->va_start); -} - -/* * lazy_max_pages is the maximum amount of virtual address space we gather up * before attempting to purge with a TLB flush. *
@@ -1416,7 +1408,7 @@ static void free_vmap_area_noflush(strucstatic void free_unmap_vmap_area (struct vmap_area *va) {flush_cache_vunmap (va->va_start, va->va_end); -unmap_vmap_area (va); +unmap_kernel_range_noflush (va->va_start, va->va_end - va->va_start);if (debug_pagealloc_enabled_static ())flush_tlb_kernel_range (va->va_start, va->va_end);
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-the-prot-argument-from-vm_map_ram.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove the prot argument from vm_map_ram has been added to the -mm tree. Its filename is mm-remove-the-prot-argument-from-vm_map_ram.patch
The patch titled
Subject: mm: remove the prot argument from vm_map_ram
has been added to the -mm tree. Its filename is
mm-remove-the-prot-argument-from-vm_map_ram.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-the-prot-argument-from-vm_map_ram.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-the-prot-argument-from-vm_map_ram.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove the prot argument from vm_map_ram
This is always PAGE_KERNEL - for long term mappings with other properties vmap should be used.
---
drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c | 2 +- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 3 +-- drivers/media/common/videobuf2/videobuf2-vmalloc.c | 3 +-- fs/erofs/decompressor.c | 2 +- fs/xfs/xfs_buf.c | 2 +- include/linux/vmalloc.h | 3 +-- mm/nommu.c | 2 +- mm/vmalloc.c | 4 ++-- 8 files changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c renamed from drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.c~mm-remove-the-prot-argument-from-vm_map_ram +1 -1
@@ -66,7 +66,7 @@ static void *mock_dmabuf_vmap(struct dma {struct mock_dmabuf *mock =to_mock (dma_buf); -return vm_map_ram (mock->pages, mock->npages,0 ,PAGE_KERNEL ); +return vm_map_ram (mock->pages, mock->npages,0 ); }static void mock_dmabuf_vunmap (struct dma_buf *dma_buf,void *vaddr)
drivers/media/common/videobuf2/videobuf2-dma-sg.c renamed from drivers/media/common/videobuf2/videobuf2-dma-sg.c~mm-remove-the-prot-argument-from-vm_map_ram +1 -2
@@ -309,8 +309,7 @@ static void *vb2_dma_sg_vaddr(void *buf_if (buf->db_attach) buf->vaddr =dma_buf_vmap (buf->db_attach->dmabuf);else - buf->vaddr =vm_map_ram (buf->pages, - buf->num_pages,-1 ,PAGE_KERNEL ); + buf->vaddr =vm_map_ram (buf->pages, buf->num_pages,-1 ); }/* add offset in case userptr is not page-aligned */
drivers/media/common/videobuf2/videobuf2-vmalloc.c renamed from drivers/media/common/videobuf2/videobuf2-vmalloc.c~mm-remove-the-prot-argument-from-vm_map_ram +1 -2
@@ -107,8 +107,7 @@ static void *vb2_vmalloc_get_userptr(str buf->vaddr = (__force void *)ioremap (__pfn_to_phys (nums[0 ]), size + offset); }else { - buf->vaddr =vm_map_ram (frame_vector_pages (vec), n_pages,-1 , -PAGE_KERNEL ); + buf->vaddr =vm_map_ram (frame_vector_pages (vec), n_pages,-1 ); }if (!buf->vaddr)
fs/erofs/decompressor.c renamed from fs/erofs/decompressor.c~mm-remove-the-prot-argument-from-vm_map_ram +1 -1
@@ -274,7 +274,7 @@ static int z_erofs_decompress_generic(st i =0 ;while (1 ) { - dst =vm_map_ram (rq->out, nrpages_out,-1 ,PAGE_KERNEL ); + dst =vm_map_ram (rq->out, nrpages_out,-1 );/* retry two more times (totally 3 times) */ if (dst || ++i >=3 )
fs/xfs/xfs_buf.c renamed from fs/xfs/xfs_buf.c~mm-remove-the-prot-argument-from-vm_map_ram +1 -1
@@ -477,7 +477,7 @@ _xfs_buf_map_pages( nofs_flag =memalloc_nofs_save (); do { bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count, - -1, PAGE_KERNEL); + -1); if (bp->b_addr) break; vm_unmap_aliases();
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-the-prot-argument-from-vm_map_ram +1 -2
@@ -88,8 +88,7 @@ struct vmap_area {* Highlevel APIs for driver use */ extern void vm_unmap_ram (const void *mem,unsigned int count); -extern void *vm_map_ram (struct page **pages,unsigned int count, -int node,pgprot_t prot); +extern void *vm_map_ram (struct page **pages,unsigned int count,int node);extern void vm_unmap_aliases (void );#ifdef CONFIG_MMU
mm/nommu.c renamed from mm/nommu.c~mm-remove-the-prot-argument-from-vm_map_ram +1 -1
@@ -351,7 +351,7 @@ void vunmap(const void *addr) }EXPORT_SYMBOL (vunmap); -void *vm_map_ram (struct page **pages,unsigned int count,int node,pgprot_t prot) +void *vm_map_ram (struct page **pages,unsigned int count,int node) {BUG ();return NULL ;
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-the-prot-argument-from-vm_map_ram +2 -2
@@ -1834,7 +1834,7 @@ EXPORT_SYMBOL(vm_unmap_ram);* * Returns: a pointer to the address that has been mapped, or %NULL on failure */ -void *vm_map_ram (struct page **pages,unsigned int count,int node,pgprot_t prot) +void *vm_map_ram (struct page **pages,unsigned int count,int node) {unsigned long size = (unsigned long )count <<PAGE_SHIFT ;unsigned long addr;
@@ -1858,7 +1858,7 @@ void *vm_map_ram(struct page **pages, unkasan_unpoison_vmalloc (mem, size); -if (map_kernel_range (addr, size, prot, pages) <0 ) { +if (map_kernel_range (addr, size,PAGE_KERNEL , pages) <0 ) {vm_unmap_ram (mem, count);return NULL ; }
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-enforce-that-vmap-cant-map-pages-executable.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: enforce that vmap can't map pages executable has been added to the -mm tree. Its filename is mm-enforce-that-vmap-cant-map-pages-executable.patch
The patch titled
Subject: mm: enforce that vmap can't map pages executable
has been added to the -mm tree. Its filename is
mm-enforce-that-vmap-cant-map-pages-executable.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-enforce-that-vmap-cant-map-pages-executable.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-enforce-that-vmap-cant-map-pages-executable.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: enforce that vmap can't map pages executable
To help enforcing the W^X protection don't allow remapping existing pages as executable.
x86 bits from Peter Zijlstra, arm64 bits from Mark Rutland.
---
arch/arm64/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/pgtable_types.h | 6 ++++++ include/asm-generic/pgtable.h | 4 ++++ mm/vmalloc.c | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h renamed from arch/arm64/include/asm/pgtable.h~mm-enforce-that-vmap-cant-map-pages-executable +3 -0
@@ -415,6 +415,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t p#define __pgprot_modify (prot,mask,bits) \ __pgprot((pgprot_val(prot) & ~(mask)) | (bits)) +#define pgprot_nx (prot) \ + __pgprot_modify(prot, 0, PTE_PXN) +/* * Mark the prot value as uncacheable and unbufferable. */
arch/x86/include/asm/pgtable_types.h renamed from arch/x86/include/asm/pgtable_types.h~mm-enforce-that-vmap-cant-map-pages-executable +6 -0
@@ -282,6 +282,12 @@ typedef struct pgprot { pgprotval_t pgprtypedef struct {pgdval_t pgd; }pgd_t ; +static inline pgprot_t pgprot_nx (pgprot_t prot) +{ +return __pgprot (pgprot_val (prot) | _PAGE_NX); +} +#define pgprot_nx pgprot_nx +#ifdef CONFIG_X86_PAE /*
include/asm-generic/pgtable.h renamed from include/asm-generic/pgtable.h~mm-enforce-that-vmap-cant-map-pages-executable +4 -0
@@ -491,6 +491,10 @@ static inline int arch_unmap_one(struct#define flush_tlb_fix_spurious_fault (vma, address) flush_tlb_page(vma, address)#endif +#ifndef pgprot_nx +#define pgprot_nx (prot) (prot) +#endif +#ifndef pgprot_noncached#define pgprot_noncached (prot) (prot)#endif
mm/vmalloc.c renamed from mm/vmalloc.c~mm-enforce-that-vmap-cant-map-pages-executable +1 -1
@@ -2390,7 +2390,7 @@ void *vmap(struct page **pages, unsignedif (!area)return NULL ; -if (map_kernel_range ((unsigned long )area->addr, size, prot, +if (map_kernel_range ((unsigned long )area->addr, size,pgprot_nx (prot), pages) <0 ) {vunmap (area->addr);return NULL ;
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: gpu/drm: remove the powerpc hack in drm_legacy_sg_alloc has been added to the -mm tree. Its filename is gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch
The patch titled
Subject: gpu/drm: remove the powerpc hack in drm_legacy_sg_alloc
has been added to the -mm tree. Its filename is
gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: gpu/drm: remove the powerpc hack in drm_legacy_sg_alloc
The non-cached vmalloc mapping was initially added as a hack for the first-gen amigaone platform (6xx/book32s), isn't fully supported upstream, and which used the legacy radeon driver together with non-coherent DMA. However this only ever worked reliably for DRI .
Remove the hack as it is the last user of __vmalloc passing a page protection flag other than PAGE_KERNEL and didn't do anything for other platforms with non-coherent DMA.
---
drivers/gpu/drm/drm_scatter.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/gpu/drm/drm_scatter.c renamed from drivers/gpu/drm/drm_scatter.c~gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc +1 -10
@@ -43,15 +43,6 @@#define DEBUG_SCATTER 0 -static inline void *drm_vmalloc_dma (unsigned long size) -{ -#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE ) -return __vmalloc (size,GFP_KERNEL ,pgprot_noncached_wc (PAGE_KERNEL )); -#else -return vmalloc_32 (size); -#endif -} -static void drm_sg_cleanup (struct drm_sg_mem * entry) {struct page *page;
@@ -126,7 +117,7 @@ int drm_legacy_sg_alloc(struct drm_devicreturn -ENOMEM ; } - entry->virtual =drm_vmalloc_dma (pages <<PAGE_SHIFT ); + entry->virtual =vmalloc_32 (pages <<PAGE_SHIFT );if (!entry->virtual) {kfree (entry->busaddr);kfree (entry->pagelist);
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-the-pgprot-argument-to-__vmalloc.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove the pgprot argument to __vmalloc has been added to the -mm tree. Its filename is mm-remove-the-pgprot-argument-to-__vmalloc.patch
The patch titled
Subject: mm: remove the pgprot argument to __vmalloc
has been added to the -mm tree. Its filename is
mm-remove-the-pgprot-argument-to-__vmalloc.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-the-pgprot-argument-to-__vmalloc.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-the-pgprot-argument-to-__vmalloc.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove the pgprot argument to __vmalloc
The pgprot argument to __vmalloc is always PROT_KERNEL now, so remove it.
---
arch/x86/hyperv/hv_init.c | 3 +-- arch/x86/include/asm/kvm_host.h | 3 +-- arch/x86/kvm/svm/sev.c | 3 +-- drivers/block/drbd/drbd_bitmap.c | 4 +--- drivers/gpu/drm/etnaviv/etnaviv_dump.c | 4 ++-- drivers/lightnvm/pblk-init.c | 5 ++--- drivers/md/dm-bufio.c | 4 ++-- drivers/mtd/ubi/io.c | 4 ++-- drivers/scsi/sd_zbc.c | 3 +-- fs/gfs2/dir.c | 9 ++++----- fs/gfs2/quota.c | 2 +- fs/nfs/blocklayout/extent_tree.c | 2 +- fs/ntfs/malloc.h | 2 +- fs/ubifs/debug.c | 2 +- fs/ubifs/lprops.c | 2 +- fs/ubifs/lpt_commit.c | 4 ++-- fs/ubifs/orphan.c | 2 +- fs/xfs/kmem.c | 2 +- include/linux/vmalloc.h | 2 +- kernel/bpf/core.c | 6 +++--- kernel/groups.c | 2 +- kernel/module.c | 3 +-- mm/nommu.c | 15 +++++++-------- mm/page_alloc.c | 2 +- mm/percpu.c | 2 +- mm/vmalloc.c | 4 ++-- net/bridge/netfilter/ebtables.c | 6 ++---- sound/core/memalloc.c | 2 +- sound/core/pcm_memory.c | 2 +- 29 files changed, 47 insertions(+), 59 deletions(-)
arch/x86/hyperv/hv_init.c renamed from arch/x86/hyperv/hv_init.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -2
@@ -96,8 +96,7 @@ static int hv_cpu_init(unsigned int cpu)* not be stopped in the case of CPU offlining and the VM will hang. */ if (!*hvp) { - *hvp =__vmalloc (PAGE_SIZE ,GFP_KERNEL | __GFP_ZERO, -PAGE_KERNEL ); + *hvp =__vmalloc (PAGE_SIZE ,GFP_KERNEL | __GFP_ZERO); }if (*hvp) {
arch/x86/include/asm/kvm_host.h renamed from arch/x86/include/asm/kvm_host.h~mm-remove-the-pgprot-argument-to-__vmalloc +1 -2
@@ -1280,8 +1280,7 @@ extern struct kmem_cache *x86_fpu_cache;#define __KVM_HAVE_ARCH_VM_ALLOCstatic inline struct kvm *kvm_arch_alloc_vm (void ) { -return __vmalloc (kvm_x86_ops.vm_size, -GFP_KERNEL_ACCOUNT | __GFP_ZERO,PAGE_KERNEL ); +return __vmalloc (kvm_x86_ops.vm_size,GFP_KERNEL_ACCOUNT | __GFP_ZERO); }void kvm_arch_free_vm (struct kvm *kvm);
arch/x86/kvm/svm/sev.c renamed from arch/x86/kvm/svm/sev.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -2
@@ -335,8 +335,7 @@ static struct page **sev_pin_memory(stru/* Avoid using vmalloc for smaller buffers. */ size = npages *sizeof (struct page *);if (size >PAGE_SIZE ) - pages =__vmalloc (size,GFP_KERNEL_ACCOUNT | __GFP_ZERO, -PAGE_KERNEL ); + pages =__vmalloc (size,GFP_KERNEL_ACCOUNT | __GFP_ZERO);else pages =kmalloc (size,GFP_KERNEL_ACCOUNT );
drivers/block/drbd/drbd_bitmap.c renamed from drivers/block/drbd/drbd_bitmap.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -3
@@ -396,9 +396,7 @@ static struct page **bm_realloc_pages(st bytes =sizeof (struct page *)*want; new_pages =kzalloc (bytes,GFP_NOIO | __GFP_NOWARN);if (!new_pages) { - new_pages =__vmalloc (bytes, -GFP_NOIO | __GFP_ZERO, -PAGE_KERNEL ); + new_pages =__vmalloc (bytes,GFP_NOIO | __GFP_ZERO);if (!new_pages)return NULL ; }
drivers/gpu/drm/etnaviv/etnaviv_dump.c renamed from drivers/gpu/drm/etnaviv/etnaviv_dump.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -2
@@ -154,8 +154,8 @@ void etnaviv_core_dump(struct etnaviv_ge file_size +=sizeof (*iter.hdr) * n_obj;/* Allocate the file in vmalloc memory, it's likely to be big */ - iter.start =__vmalloc (file_size,GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, -PAGE_KERNEL ); + iter.start =__vmalloc (file_size,GFP_KERNEL | __GFP_NOWARN | + __GFP_NORETRY);if (!iter.start) {mutex_unlock (&gpu->mmu_context->lock);dev_warn (gpu->dev,"failed to allocate devcoredump file\n" );
drivers/lightnvm/pblk-init.c renamed from drivers/lightnvm/pblk-init.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -3
@@ -145,9 +145,8 @@ static int pblk_l2p_init(struct pblk *pbint ret =0 ; map_size =pblk_trans_map_size (pblk); - pblk->trans_map =__vmalloc (map_size,GFP_KERNEL | __GFP_NOWARN - | __GFP_RETRY_MAYFAIL | __GFP_HIGHMEM, -PAGE_KERNEL ); + pblk->trans_map =__vmalloc (map_size,GFP_KERNEL | __GFP_NOWARN | + __GFP_RETRY_MAYFAIL | __GFP_HIGHMEM);if (!pblk->trans_map) {pblk_err (pblk,"failed to allocate L2P (need %zu of memory)\n" , map_size);
drivers/md/dm-bufio.c renamed from drivers/md/dm-bufio.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -2
@@ -400,13 +400,13 @@ static void *alloc_buffer_data(struct dm*/ if (gfp_mask & __GFP_NORETRY) {unsigned noio_flag =memalloc_noio_save (); -void *ptr =__vmalloc (c->block_size, gfp_mask,PAGE_KERNEL ); +void *ptr =__vmalloc (c->block_size, gfp_mask);memalloc_noio_restore (noio_flag);return ptr; } -return __vmalloc (c->block_size, gfp_mask,PAGE_KERNEL ); +return __vmalloc (c->block_size, gfp_mask); }/*
drivers/mtd/ubi/io.c renamed from drivers/mtd/ubi/io.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -2
@@ -1297,7 +1297,7 @@ static int self_check_write(struct ubi_dif (!ubi_dbg_chk_io (ubi))return 0 ; - buf1 =__vmalloc (len,GFP_NOFS ,PAGE_KERNEL ); + buf1 =__vmalloc (len,GFP_NOFS );if (!buf1) {ubi_err (ubi,"cannot allocate memory to check writes" );return 0 ;
@@ -1361,7 +1361,7 @@ int ubi_self_check_all_ff(struct ubi_devif (!ubi_dbg_chk_io (ubi))return 0 ; - buf =__vmalloc (len,GFP_NOFS ,PAGE_KERNEL ); + buf =__vmalloc (len,GFP_NOFS );if (!buf) {ubi_err (ubi,"cannot allocate memory to check for 0xFFs" );return 0 ;
drivers/scsi/sd_zbc.c renamed from drivers/scsi/sd_zbc.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -2
@@ -136,8 +136,7 @@ static void *sd_zbc_alloc_report_buffer(while (bufsize >=SECTOR_SIZE ) { buf =__vmalloc (bufsize, -GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY, -PAGE_KERNEL ); +GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY);if (buf) { *buflen = bufsize;return buf;
fs/gfs2/dir.c renamed from fs/gfs2/dir.c~mm-remove-the-pgprot-argument-to-__vmalloc +4 -5
@@ -354,7 +354,7 @@ static __be64 *gfs2_dir_get_hash_table(s hc =kmalloc (hsize,GFP_NOFS | __GFP_NOWARN);if (hc ==NULL ) - hc =__vmalloc (hsize,GFP_NOFS ,PAGE_KERNEL ); + hc =__vmalloc (hsize,GFP_NOFS );if (hc ==NULL )return ERR_PTR (-ENOMEM );
@@ -1166,7 +1166,7 @@ static int dir_double_exhash(struct gfs2 hc2 =kmalloc_array (hsize_bytes,2 ,GFP_NOFS | __GFP_NOWARN);if (hc2 ==NULL ) - hc2 =__vmalloc (hsize_bytes *2 ,GFP_NOFS ,PAGE_KERNEL ); + hc2 =__vmalloc (hsize_bytes *2 ,GFP_NOFS );if (!hc2)return -ENOMEM ;
@@ -1327,7 +1327,7 @@ static void *gfs2_alloc_sort_buffer(unsiif (size <KMALLOC_MAX_SIZE ) ptr =kmalloc (size,GFP_NOFS | __GFP_NOWARN);if (!ptr) - ptr =__vmalloc (size,GFP_NOFS ,PAGE_KERNEL ); + ptr =__vmalloc (size,GFP_NOFS );return ptr; }
@@ -1987,8 +1987,7 @@ static int leaf_dealloc(struct gfs2_inod ht =kzalloc (size,GFP_NOFS | __GFP_NOWARN);if (ht ==NULL ) - ht =__vmalloc (size,GFP_NOFS | __GFP_NOWARN | __GFP_ZERO, -PAGE_KERNEL ); + ht =__vmalloc (size,GFP_NOFS | __GFP_NOWARN | __GFP_ZERO);if (!ht)return -ENOMEM ;
fs/gfs2/quota.c renamed from fs/gfs2/quota.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -1368,7 +1368,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp sdp->sd_quota_bitmap =kzalloc (bm_size,GFP_NOFS | __GFP_NOWARN);if (sdp->sd_quota_bitmap ==NULL ) sdp->sd_quota_bitmap =__vmalloc (bm_size,GFP_NOFS | - __GFP_ZERO,PAGE_KERNEL ); + __GFP_ZERO);if (!sdp->sd_quota_bitmap)return error;
fs/nfs/blocklayout/extent_tree.c renamed from fs/nfs/blocklayout/extent_tree.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -582,7 +582,7 @@ retry:if (!arg->layoutupdate_pages)return -ENOMEM ; - start_p =__vmalloc (buffer_size,GFP_NOFS ,PAGE_KERNEL ); + start_p =__vmalloc (buffer_size,GFP_NOFS );if (!start_p) {kfree (arg->layoutupdate_pages);return -ENOMEM ;
fs/ntfs/malloc.h renamed from fs/ntfs/malloc.h~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -34,7 +34,7 @@ static inline void *__ntfs_malloc(unsign/* return (void *)__get_free_page(gfp_mask); */ }if (likely ((size >>PAGE_SHIFT ) <totalram_pages ())) -return __vmalloc (size, gfp_mask,PAGE_KERNEL ); +return __vmalloc (size, gfp_mask);return NULL ; }
fs/ubifs/debug.c renamed from fs/ubifs/debug.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -815,7 +815,7 @@ void ubifs_dump_leb(const struct ubifs_ipr_err ("(pid %d) start dumping LEB %d\n" , current->pid, lnum); - buf =__vmalloc (c->leb_size,GFP_NOFS ,PAGE_KERNEL ); + buf =__vmalloc (c->leb_size,GFP_NOFS );if (!buf) {ubifs_err (c,"cannot allocate memory for dumping LEB %d" , lnum);return ;
fs/ubifs/lprops.c renamed from fs/ubifs/lprops.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -1095,7 +1095,7 @@ static int scan_check_cb(struct ubifs_inreturn LPT_SCAN_CONTINUE ; } - buf =__vmalloc (c->leb_size,GFP_NOFS ,PAGE_KERNEL ); + buf =__vmalloc (c->leb_size,GFP_NOFS );if (!buf)return -ENOMEM ;
fs/ubifs/lpt_commit.c renamed from fs/ubifs/lpt_commit.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -2
@@ -1596,7 +1596,7 @@ static int dbg_check_ltab_lnum(struct ubif (!dbg_is_chk_lprops (c))return 0 ; - buf = p =__vmalloc (c->leb_size,GFP_NOFS ,PAGE_KERNEL ); + buf = p =__vmalloc (c->leb_size,GFP_NOFS );if (!buf) {ubifs_err (c,"cannot allocate memory for ltab checking" );return 0 ;
@@ -1845,7 +1845,7 @@ static void dump_lpt_leb(const struct ubvoid *buf, *p;pr_err ("(pid %d) start dumping LEB %d\n" , current->pid, lnum); - buf = p =__vmalloc (c->leb_size,GFP_NOFS ,PAGE_KERNEL ); + buf = p =__vmalloc (c->leb_size,GFP_NOFS );if (!buf) {ubifs_err (c,"cannot allocate memory to dump LPT" );return ;
fs/ubifs/orphan.c renamed from fs/ubifs/orphan.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -977,7 +977,7 @@ static int dbg_scan_orphans(struct ubifsif (c->no_orphs)return 0 ; - buf =__vmalloc (c->leb_size,GFP_NOFS ,PAGE_KERNEL ); + buf =__vmalloc (c->leb_size,GFP_NOFS );if (!buf) {ubifs_err (c,"cannot allocate memory to check orphans" );return 0 ;
fs/xfs/kmem.c renamed from fs/xfs/kmem.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -48,7 +48,7 @@ __kmem_vmalloc(size_t size, xfs_km_flagsif (flags &KM_NOFS ) nofs_flag =memalloc_nofs_save (); - ptr =__vmalloc (size, lflags,PAGE_KERNEL ); + ptr =__vmalloc (size, lflags);if (flags &KM_NOFS )memalloc_nofs_restore (nofs_flag);
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -110,7 +110,7 @@ extern void *vmalloc_user_node_flags(unsextern void *vmalloc_exec (unsigned long size);extern void *vmalloc_32 (unsigned long size);extern void *vmalloc_32_user (unsigned long size); -extern void *__vmalloc (unsigned long size,gfp_t gfp_mask,pgprot_t prot); +extern void *__vmalloc (unsigned long size,gfp_t gfp_mask); extern void *__vmalloc_node_range(unsigned long size, unsigned long align, unsigned long start, unsigned long end, gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, int node,
kernel/bpf/core.c renamed from kernel/bpf/core.c~mm-remove-the-pgprot-argument-to-__vmalloc +3 -3
@@ -82,7 +82,7 @@ struct bpf_prog *bpf_prog_alloc_no_statsstruct bpf_prog *fp; size =round_up (size,PAGE_SIZE ); - fp =__vmalloc (size, gfp_flags,PAGE_KERNEL ); + fp =__vmalloc (size, gfp_flags);if (fp ==NULL )return NULL ;
@@ -232,7 +232,7 @@ struct bpf_prog *bpf_prog_realloc(structif (ret)return NULL ; - fp =__vmalloc (size, gfp_flags,PAGE_KERNEL ); + fp =__vmalloc (size, gfp_flags);if (fp ==NULL ) {__bpf_prog_uncharge (fp_old->aux->user, delta); }else {
@@ -1089,7 +1089,7 @@ static struct bpf_prog *bpf_prog_clone_cgfp_t gfp_flags =GFP_KERNEL | __GFP_ZERO | gfp_extra_flags;struct bpf_prog *fp; - fp =__vmalloc (fp_other->pages *PAGE_SIZE , gfp_flags,PAGE_KERNEL ); + fp =__vmalloc (fp_other->pages *PAGE_SIZE , gfp_flags);if (fp !=NULL ) {/* aux->prog still points to the fp_other one, so * when promoting the clone to the real program,
kernel/groups.c renamed from kernel/groups.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -20,7 +20,7 @@ struct group_info *groups_alloc(int gids len =sizeof (struct group_info ) +sizeof (kgid_t) * gidsetsize; gi =kmalloc (len,GFP_KERNEL_ACCOUNT |__GFP_NOWARN|__GFP_NORETRY);if (!gi) - gi =__vmalloc (len,GFP_KERNEL_ACCOUNT ,PAGE_KERNEL ); + gi =__vmalloc (len,GFP_KERNEL_ACCOUNT );if (!gi)return NULL ;
kernel/module.c renamed from kernel/module.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -2
@@ -2946,8 +2946,7 @@ static int copy_module_from_user(const vreturn err;/* Suck in entire file: we'll want most of it. */ - info->hdr =__vmalloc (info->len, -GFP_KERNEL | __GFP_NOWARN,PAGE_KERNEL ); + info->hdr =__vmalloc (info->len,GFP_KERNEL | __GFP_NOWARN);if (!info->hdr)return -ENOMEM ;
mm/nommu.c renamed from mm/nommu.c~mm-remove-the-pgprot-argument-to-__vmalloc +7 -8
@@ -140,7 +140,7 @@ void vfree(const void *addr) }EXPORT_SYMBOL (vfree); -void *__vmalloc (unsigned long size,gfp_t gfp_mask,pgprot_t prot) +void *__vmalloc (unsigned long size,gfp_t gfp_mask) {/* * You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc()
@@ -152,14 +152,14 @@ EXPORT_SYMBOL(__vmalloc);void *__vmalloc_node_flags (unsigned long size,int node,gfp_t flags) { -return __vmalloc (size, flags,PAGE_KERNEL ); +return __vmalloc (size, flags); }static void *__vmalloc_user_flags (unsigned long size,gfp_t flags) {void *ret; - ret =__vmalloc (size, flags,PAGE_KERNEL ); + ret =__vmalloc (size, flags);if (ret) {struct vm_area_struct *vma;
@@ -230,7 +230,7 @@ long vwrite(char *buf, char *addr, unsig*/ void *vmalloc (unsigned long size) { -return __vmalloc (size,GFP_KERNEL | __GFP_HIGHMEM,PAGE_KERNEL ); +return __vmalloc (size,GFP_KERNEL | __GFP_HIGHMEM); }EXPORT_SYMBOL (vmalloc);
@@ -248,8 +248,7 @@ EXPORT_SYMBOL(vmalloc);*/ void *vzalloc (unsigned long size) { -return __vmalloc (size,GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, -PAGE_KERNEL ); +return __vmalloc (size,GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); }EXPORT_SYMBOL (vzalloc);
@@ -302,7 +301,7 @@ EXPORT_SYMBOL(vzalloc_node);void *vmalloc_exec (unsigned long size) { -return __vmalloc (size,GFP_KERNEL | __GFP_HIGHMEM,PAGE_KERNEL_EXEC ); +return __vmalloc (size,GFP_KERNEL | __GFP_HIGHMEM); }/**
@@ -314,7 +313,7 @@ void *vmalloc_exec(unsigned long size)*/ void *vmalloc_32 (unsigned long size) { -return __vmalloc (size,GFP_KERNEL ,PAGE_KERNEL ); +return __vmalloc (size,GFP_KERNEL ); }EXPORT_SYMBOL (vmalloc_32);
mm/page_alloc.c renamed from mm/page_alloc.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -8238,7 +8238,7 @@ void *__init alloc_large_system_hash(con table =memblock_alloc_raw (size,SMP_CACHE_BYTES ); }else if (get_order (size) >=MAX_ORDER || hashdist) { - table =__vmalloc (size, gfp_flags,PAGE_KERNEL ); + table =__vmalloc (size, gfp_flags); virt = true; }else {/*
mm/percpu.c renamed from mm/percpu.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -481,7 +481,7 @@ static void *pcpu_mem_zalloc(size_t sizeif (size <=PAGE_SIZE )return kzalloc (size, gfp);else -return __vmalloc (size, gfp | __GFP_ZERO,PAGE_KERNEL ); +return __vmalloc (size, gfp | __GFP_ZERO); }/**
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -2
@@ -2563,9 +2563,9 @@ static void *__vmalloc_node(unsigned lon gfp_mask, prot, 0, node, caller); } -void *__vmalloc (unsigned long size,gfp_t gfp_mask,pgprot_t prot) +void *__vmalloc (unsigned long size,gfp_t gfp_mask) { -return __vmalloc_node (size,1 , gfp_mask, prot,NUMA_NO_NODE , +return __vmalloc_node (size,1 , gfp_mask,PAGE_KERNEL ,NUMA_NO_NODE ,__builtin_return_address (0 )); }EXPORT_SYMBOL (__vmalloc);
net/bridge/netfilter/ebtables.c renamed from net/bridge/netfilter/ebtables.c~mm-remove-the-pgprot-argument-to-__vmalloc +2 -4
@@ -1095,16 +1095,14 @@ static int do_replace(struct net *net, c tmp.name[sizeof (tmp.name) -1 ] =0 ; countersize =COUNTER_OFFSET (tmp.nentries) * nr_cpu_ids; - newinfo =__vmalloc (sizeof (*newinfo) + countersize,GFP_KERNEL_ACCOUNT , -PAGE_KERNEL ); + newinfo =__vmalloc (sizeof (*newinfo) + countersize,GFP_KERNEL_ACCOUNT );if (!newinfo)return -ENOMEM ;if (countersize)memset (newinfo->counters,0 , countersize); - newinfo->entries =__vmalloc (tmp.entries_size,GFP_KERNEL_ACCOUNT , -PAGE_KERNEL ); + newinfo->entries =__vmalloc (tmp.entries_size,GFP_KERNEL_ACCOUNT );if (!newinfo->entries) { ret = -ENOMEM ; goto free_newinfo;
sound/core/memalloc.c renamed from sound/core/memalloc.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -143,7 +143,7 @@ int snd_dma_alloc_pages(int type, structbreak ;case SNDRV_DMA_TYPE_VMALLOC : gfp =snd_mem_get_gfp_flags (device,GFP_KERNEL | __GFP_HIGHMEM); - dmab->area =__vmalloc (size, gfp,PAGE_KERNEL ); + dmab->area =__vmalloc (size, gfp); dmab->addr =0 ;break ;#ifdef CONFIG_HAS_DMA
sound/core/pcm_memory.c renamed from sound/core/pcm_memory.c~mm-remove-the-pgprot-argument-to-__vmalloc +1 -1
@@ -460,7 +460,7 @@ int _snd_pcm_lib_alloc_vmalloc_buffer(streturn 0 ;/* already large enough */ vfree (runtime->dma_area); } - runtime->dma_area =__vmalloc (size, gfp_flags,PAGE_KERNEL ); + runtime->dma_area =__vmalloc (size, gfp_flags);if (!runtime->dma_area)return -ENOMEM ; runtime->dma_bytes = size;
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-the-prot-argument-to-__vmalloc_node.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove the prot argument to __vmalloc_node has been added to the -mm tree. Its filename is mm-remove-the-prot-argument-to-__vmalloc_node.patch
The patch titled
Subject: mm: remove the prot argument to __vmalloc_node
has been added to the -mm tree. Its filename is
mm-remove-the-prot-argument-to-__vmalloc_node.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-the-prot-argument-to-__vmalloc_node.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-the-prot-argument-to-__vmalloc_node.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove the prot argument to __vmalloc_node
This is always PAGE_KERNEL now.
---
mm/vmalloc.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-the-prot-argument-to-__vmalloc_node +14 -21
@@ -2401,8 +2401,7 @@ void *vmap(struct page **pages, unsignedEXPORT_SYMBOL (vmap);static void *__vmalloc_node (unsigned long size,unsigned long align, -gfp_t gfp_mask,pgprot_t prot, -int node,const void *caller); +gfp_t gfp_mask,int node,const void *caller);static void *__vmalloc_area_node (struct vm_struct *area,gfp_t gfp_mask,pgprot_t prot,int node) {
@@ -2420,7 +2419,7 @@ static void *__vmalloc_area_node(struct/* Please note that the recursion is strictly bounded. */ if (array_size >PAGE_SIZE ) { pages =__vmalloc_node (array_size,1 , nested_gfp|highmem_mask, -PAGE_KERNEL , node, area->caller); + node, area->caller); }else { pages =kmalloc_node (array_size, nested_gfp, node); }
@@ -2539,13 +2538,11 @@ EXPORT_SYMBOL_GPL(__vmalloc_node_range);* @size: allocation size * @align: desired alignment * @gfp_mask: flags for the page level allocator -* @prot: protection mask for the allocated pages * @node: node to use for allocation or NUMA_NO_NODE * @caller: caller's return address * -* Allocate enough pages to cover @size from the page level -* allocator with @gfp_mask flags. Map them into contiguous -* kernel virtual space, using a pagetable protection of @prot. +* Allocate enough pages to cover @size from the page level allocator with +* @gfp_mask flags. Map them into contiguous kernel virtual space. * * Reclaim modifiers in @gfp_mask - __GFP_NORETRY, __GFP_RETRY_MAYFAIL * and __GFP_NOFAIL are not supported
@@ -2556,16 +2553,15 @@ EXPORT_SYMBOL_GPL(__vmalloc_node_range);* Return: pointer to the allocated memory or %NULL on error */ static void *__vmalloc_node (unsigned long size,unsigned long align, -gfp_t gfp_mask,pgprot_t prot, -int node,const void *caller) +gfp_t gfp_mask,int node,const void *caller) {return __vmalloc_node_range (size, align,VMALLOC_START ,VMALLOC_END , - gfp_mask, prot,0 , node, caller); + gfp_mask,PAGE_KERNEL ,0 , node, caller); }void *__vmalloc (unsigned long size,gfp_t gfp_mask) { -return __vmalloc_node (size,1 , gfp_mask,PAGE_KERNEL ,NUMA_NO_NODE , +return __vmalloc_node (size,1 , gfp_mask,NUMA_NO_NODE ,__builtin_return_address (0 )); }EXPORT_SYMBOL (__vmalloc);
@@ -2573,15 +2569,15 @@ EXPORT_SYMBOL(__vmalloc);static inline void *__vmalloc_node_flags (unsigned long size,int node,gfp_t flags) { -return __vmalloc_node (size,1 , flags,PAGE_KERNEL , - node,__builtin_return_address (0 )); +return __vmalloc_node (size,1 , flags, node, +__builtin_return_address (0 )); }void *__vmalloc_node_flags_caller (unsigned long size,int node,gfp_t flags,void *caller) { -return __vmalloc_node (size,1 , flags,PAGE_KERNEL , node, caller); +return __vmalloc_node (size,1 , flags, node, caller); }/**
@@ -2656,8 +2652,8 @@ EXPORT_SYMBOL(vmalloc_user);*/ void *vmalloc_node (unsigned long size,int node) { -return __vmalloc_node (size,1 ,GFP_KERNEL ,PAGE_KERNEL , - node,__builtin_return_address (0 )); +return __vmalloc_node (size,1 ,GFP_KERNEL , node, +__builtin_return_address (0 )); }EXPORT_SYMBOL (vmalloc_node);
@@ -2670,9 +2666,6 @@ EXPORT_SYMBOL(vmalloc_node);* allocator and map them into contiguous kernel virtual space. * The memory allocated is set to zero. * -* For tight control over page level allocator and protection flags -* use __vmalloc_node() instead. -* * Return: pointer to the allocated memory or %NULL on error */ void *vzalloc_node (unsigned long size,int node)
@@ -2745,8 +2738,8 @@ void *vmalloc_exec(unsigned long size)*/ void *vmalloc_32 (unsigned long size) { -return __vmalloc_node (size,1 ,GFP_VMALLOC32 ,PAGE_KERNEL , -NUMA_NO_NODE ,__builtin_return_address (0 )); +return __vmalloc_node (size,1 ,GFP_VMALLOC32 ,NUMA_NO_NODE , +__builtin_return_address (0 )); }EXPORT_SYMBOL (vmalloc_32);
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-both-instances-of-__vmalloc_node_flags.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove both instances of __vmalloc_node_flags has been added to the -mm tree. Its filename is mm-remove-both-instances-of-__vmalloc_node_flags.patch
The patch titled
Subject: mm: remove both instances of __vmalloc_node_flags
has been added to the -mm tree. Its filename is
mm-remove-both-instances-of-__vmalloc_node_flags.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-both-instances-of-__vmalloc_node_flags.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-both-instances-of-__vmalloc_node_flags.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove both instances of __vmalloc_node_flags
The real version just had a few callers that can open code it and remove one layer of indirection. The nommu stub was public but only had a single caller, so remove it and avoid a CONFIG_MMU ifdef in vmalloc.h.
---
include/linux/vmalloc.h | 9 --------- mm/nommu.c | 3 ++- mm/vmalloc.c | 20 ++++++-------------- 3 files changed, 8 insertions(+), 24 deletions(-)
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-both-instances-of-__vmalloc_node_flags +0 -9
@@ -115,17 +115,8 @@ extern void *__vmalloc_node_range(unsign unsigned long start, unsigned long end, gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, int node, const void *caller); -#ifndef CONFIG_MMU -extern void *__vmalloc_node_flags (unsigned long size,int node,gfp_t flags); -static inline void *__vmalloc_node_flags_caller (unsigned long size,int node, -gfp_t flags,void *caller) -{ -return __vmalloc_node_flags (size, node, flags); -} -#else extern void *__vmalloc_node_flags_caller (unsigned long size,int node,gfp_t flags,void *caller); -#endif extern void vfree (const void *addr);extern void vfree_atomic (const void *addr);
mm/nommu.c renamed from mm/nommu.c~mm-remove-both-instances-of-__vmalloc_node_flags +2 -1
@@ -150,7 +150,8 @@ void *__vmalloc(unsigned long size, gfp_ }EXPORT_SYMBOL (__vmalloc); -void *__vmalloc_node_flags (unsigned long size,int node,gfp_t flags) +void *__vmalloc_node_flags_caller (unsigned long size,int node,gfp_t flags, +void *caller) {return __vmalloc (size, flags); }
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-both-instances-of-__vmalloc_node_flags +6 -14
@@ -2566,14 +2566,6 @@ void *__vmalloc(unsigned long size, gfp_ }EXPORT_SYMBOL (__vmalloc); -static inline void *__vmalloc_node_flags (unsigned long size, -int node,gfp_t flags) -{ -return __vmalloc_node (size,1 , flags, node, -__builtin_return_address (0 )); -} - -void *__vmalloc_node_flags_caller (unsigned long size,int node,gfp_t flags,void *caller) {
@@ -2594,8 +2586,8 @@ void *__vmalloc_node_flags_caller(unsign*/ void *vmalloc (unsigned long size) { -return __vmalloc_node_flags (size,NUMA_NO_NODE , -GFP_KERNEL ); +return __vmalloc_node (size,1 ,GFP_KERNEL ,NUMA_NO_NODE , +__builtin_return_address (0 )); }EXPORT_SYMBOL (vmalloc);
@@ -2614,8 +2606,8 @@ EXPORT_SYMBOL(vmalloc);*/ void *vzalloc (unsigned long size) { -return __vmalloc_node_flags (size,NUMA_NO_NODE , -GFP_KERNEL | __GFP_ZERO); +return __vmalloc_node (size,1 ,GFP_KERNEL | __GFP_ZERO,NUMA_NO_NODE , +__builtin_return_address (0 )); }EXPORT_SYMBOL (vzalloc);
@@ -2670,8 +2662,8 @@ EXPORT_SYMBOL(vmalloc_node);*/ void *vzalloc_node (unsigned long size,int node) { -return __vmalloc_node_flags (size, node, -GFP_KERNEL | __GFP_ZERO); +return __vmalloc_node (size,1 ,GFP_KERNEL | __GFP_ZERO, node, +__builtin_return_address (0 )); }EXPORT_SYMBOL (vzalloc_node);
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-__vmalloc_node_flags_caller.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove __vmalloc_node_flags_caller has been added to the -mm tree. Its filename is mm-remove-__vmalloc_node_flags_caller.patch
The patch titled
Subject: mm: remove __vmalloc_node_flags_caller
has been added to the -mm tree. Its filename is
mm-remove-__vmalloc_node_flags_caller.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-__vmalloc_node_flags_caller.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-__vmalloc_node_flags_caller.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove __vmalloc_node_flags_caller
Just use __vmalloc_node instead which gets and extra argument. To be able to to use __vmalloc_node in all caller make it available outside of vmalloc and implement it in nommu.c.
---
include/linux/vmalloc.h | 4 ++-- kernel/bpf/syscall.c | 5 ++--- mm/nommu.c | 4 ++-- mm/util.c | 2 +- mm/vmalloc.c | 10 +--------- 5 files changed, 8 insertions(+), 17 deletions(-)
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-__vmalloc_node_flags_caller +2 -2
@@ -115,8 +115,8 @@ extern void *__vmalloc_node_range(unsign unsigned long start, unsigned long end, gfp_t gfp_mask, pgprot_t prot, unsigned long vm_flags, int node, const void *caller); -extern void *__vmalloc_node_flags_caller (unsigned long size, -int node,gfp_t flags,void *caller); +void *__vmalloc_node (unsigned long size,unsigned long align,gfp_t gfp_mask, +int node,const void *caller);extern void vfree (const void *addr);extern void vfree_atomic (const void *addr);
kernel/bpf/syscall.c renamed from kernel/bpf/syscall.c~mm-remove-__vmalloc_node_flags_caller +2 -3
@@ -299,9 +299,8 @@ static void *__bpf_map_area_alloc(u64 sireturn vmalloc_user_node_flags (size, numa_node,GFP_KERNEL | __GFP_RETRY_MAYFAIL | flags); } -return __vmalloc_node_flags_caller (size, numa_node, -GFP_KERNEL | __GFP_RETRY_MAYFAIL | - flags,__builtin_return_address (0 )); +return __vmalloc_node (size,1 ,GFP_KERNEL | __GFP_RETRY_MAYFAIL | flags, + numa_node,__builtin_return_address (0 )); }void *bpf_map_area_alloc (u64 size,int numa_node)
mm/nommu.c renamed from mm/nommu.c~mm-remove-__vmalloc_node_flags_caller +2 -2
@@ -150,8 +150,8 @@ void *__vmalloc(unsigned long size, gfp_ }EXPORT_SYMBOL (__vmalloc); -void *__vmalloc_node_flags_caller (unsigned long size,int node,gfp_t flags, -void *caller) +void *__vmalloc_node (unsigned long size,unsigned long align,gfp_t gfp_mask, +int node,const void *caller) {return __vmalloc (size, flags); }
mm/util.c renamed from mm/util.c~mm-remove-__vmalloc_node_flags_caller +1 -1
@@ -580,7 +580,7 @@ void *kvmalloc_node(size_t size, gfp_t fif (ret || size <=PAGE_SIZE )return ret; -return __vmalloc_node_flags_caller (size, node, flags, +return __vmalloc_node (size,1 , flags, node,__builtin_return_address (0 )); }EXPORT_SYMBOL (kvmalloc_node);
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-__vmalloc_node_flags_caller +1 -9
@@ -2400,8 +2400,6 @@ void *vmap(struct page **pages, unsigned }EXPORT_SYMBOL (vmap); -static void *__vmalloc_node (unsigned long size,unsigned long align, -gfp_t gfp_mask,int node,const void *caller);static void *__vmalloc_area_node (struct vm_struct *area,gfp_t gfp_mask,pgprot_t prot,int node) {
@@ -2552,7 +2550,7 @@ EXPORT_SYMBOL_GPL(__vmalloc_node_range);* * Return: pointer to the allocated memory or %NULL on error */ -static void *__vmalloc_node (unsigned long size,unsigned long align, +void *__vmalloc_node (unsigned long size,unsigned long align,gfp_t gfp_mask,int node,const void *caller) { return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
@@ -2566,12 +2564,6 @@ void *__vmalloc(unsigned long size, gfp_ }EXPORT_SYMBOL (__vmalloc); -void *__vmalloc_node_flags_caller (unsigned long size,int node,gfp_t flags, -void *caller) -{ -return __vmalloc_node (size,1 , flags, node, caller); -} -/** * vmalloc - allocate virtually contiguous memory * @size: allocation size
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: switch the test_vmalloc module to use __vmalloc_node has been added to the -mm tree. Its filename is mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch
The patch titled
Subject: mm: switch the test_vmalloc module to use __vmalloc_node
has been added to the -mm tree. Its filename is
mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: switch the test_vmalloc module to use __vmalloc_node
No need to export the very low-level __vmalloc_node_range when the test module can use a slightly higher level variant.
---
lib/test_vmalloc.c | 26 +++++++------------------- mm/vmalloc.c | 17 ++++++++--------- 2 files changed, 15 insertions(+), 28 deletions(-)
lib/test_vmalloc.c renamed from lib/test_vmalloc.c~mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node +7 -19
@@ -91,12 +91,8 @@ static int random_size_align_alloc_test(*/ size = ((rnd %10 ) +1 ) *PAGE_SIZE ; - ptr =__vmalloc_node_range (size, align, -VMALLOC_START ,VMALLOC_END , -GFP_KERNEL | __GFP_ZERO, -PAGE_KERNEL , -0 ,0 ,__builtin_return_address (0 )); - + ptr =__vmalloc_node (size, align,GFP_KERNEL | __GFP_ZERO, +__builtin_return_address (0 ));if (!ptr)return -1 ;
@@ -118,12 +114,8 @@ static int align_shift_alloc_test(void)for (i =0 ; i <BITS_PER_LONG ; i++) { align = ((unsigned long )1 ) << i; - ptr =__vmalloc_node_range (PAGE_SIZE , align, -VMALLOC_START ,VMALLOC_END , -GFP_KERNEL | __GFP_ZERO, -PAGE_KERNEL , -0 ,0 ,__builtin_return_address (0 )); - + ptr =__vmalloc_node (PAGE_SIZE , align,GFP_KERNEL | __GFP_ZERO, +__builtin_return_address (0 ));if (!ptr)return -1 ;
@@ -139,13 +131,9 @@ static int fix_align_alloc_test(void)int i;for (i =0 ; i < test_loop_count; i++) { - ptr =__vmalloc_node_range (5 *PAGE_SIZE , -THREAD_ALIGN <<1 , -VMALLOC_START ,VMALLOC_END , -GFP_KERNEL | __GFP_ZERO, -PAGE_KERNEL , -0 ,0 ,__builtin_return_address (0 )); - + ptr =__vmalloc_node (5 *PAGE_SIZE ,THREAD_ALIGN <<1 , +GFP_KERNEL | __GFP_ZERO, +__builtin_return_address (0 ));if (!ptr)return -1 ;
mm/vmalloc.c renamed from mm/vmalloc.c~mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node +8 -9
@@ -2522,15 +2522,6 @@ fail:return NULL ; } -/* -* This is only for performance analysis of vmalloc and stress purpose. -* It is required by vmalloc test module, therefore do not use it other -* than that. -*/ -#ifdef CONFIG_TEST_VMALLOC_MODULE -EXPORT_SYMBOL_GPL (__vmalloc_node_range); -#endif -/** * __vmalloc_node - allocate virtually contiguous memory * @size: allocation size
@@ -2556,6 +2547,14 @@ void *__vmalloc_node(unsigned long size,return __vmalloc_node_range (size, align,VMALLOC_START ,VMALLOC_END , gfp_mask,PAGE_KERNEL ,0 , node, caller); } +/* +* This is only for performance analysis of vmalloc and stress purpose. +* It is required by vmalloc test module, therefore do not use it other +* than that. +*/ +#ifdef CONFIG_TEST_VMALLOC_MODULE +EXPORT_SYMBOL_GPL (__vmalloc_node); +#endif void *__vmalloc (unsigned long size,gfp_t gfp_mask) {
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ mm-remove-vmalloc_user_node_flags.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm: remove vmalloc_user_node_flags has been added to the -mm tree. Its filename is mm-remove-vmalloc_user_node_flags.patch
The patch titled
Subject: mm: remove vmalloc_user_node_flags
has been added to the -mm tree. Its filename is
mm-remove-vmalloc_user_node_flags.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-vmalloc_user_node_flags.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-vmalloc_user_node_flags.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm: remove vmalloc_user_node_flags
Open code it in __bpf_map_area_alloc, which is the only caller. Also clean up __bpf_map_area_alloc to have a single vmalloc call with slightly different flags instead of the current two different calls.
For this to compile for the nommu case add a __vmalloc_node_range stub to nommu.c.
---
include/linux/vmalloc.h | 1 - kernel/bpf/syscall.c | 24 ++++++++++++++---------- mm/nommu.c | 14 ++++++++------ mm/vmalloc.c | 20 -------------------- 4 files changed, 22 insertions(+), 37 deletions(-)
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~mm-remove-vmalloc_user_node_flags +0 -1
@@ -106,7 +106,6 @@ extern void *vzalloc(unsigned long size)extern void *vmalloc_user (unsigned long size);extern void *vmalloc_node (unsigned long size,int node);extern void *vzalloc_node (unsigned long size,int node); -extern void *vmalloc_user_node_flags (unsigned long size,int node,gfp_t flags);extern void *vmalloc_exec (unsigned long size);extern void *vmalloc_32 (unsigned long size);extern void *vmalloc_32_user (unsigned long size);
kernel/bpf/syscall.c renamed from kernel/bpf/syscall.c~mm-remove-vmalloc_user_node_flags +14 -10
@@ -25,6 +25,7 @@#include <linux/nospec.h> #include <linux/audit.h> #include <uapi/linux/btf.h> +#include <asm/pgtable.h> #include <linux/bpf_lsm.h> #define IS_FD_ARRAY (map) ((map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \
@@ -281,26 +282,29 @@ static void *__bpf_map_area_alloc(u64 si* __GFP_RETRY_MAYFAIL to avoid such situations. */ -const gfp_t flags = __GFP_NOWARN | __GFP_ZERO; +const gfp_t gfp = __GFP_NOWARN | __GFP_ZERO; +unsigned int flags =0 ; +unsigned long align =1 ;void *area;if (size >=SIZE_MAX )return NULL ;/* kmalloc()'ed memory can't be mmap()'ed */ -if (!mmapable && size <= (PAGE_SIZE <<PAGE_ALLOC_COSTLY_ORDER )) { - area =kmalloc_node (size,GFP_USER | __GFP_NORETRY | flags, +if (mmapable) { +BUG_ON (!PAGE_ALIGNED (size)); + align =SHMLBA ; + flags =VM_USERMAP ; + }else if (size <= (PAGE_SIZE <<PAGE_ALLOC_COSTLY_ORDER )) { + area =kmalloc_node (size, gfp |GFP_USER | __GFP_NORETRY, numa_node);if (area !=NULL )return area; } -if (mmapable) { -BUG_ON (!PAGE_ALIGNED (size)); -return vmalloc_user_node_flags (size, numa_node,GFP_KERNEL | - __GFP_RETRY_MAYFAIL | flags); - } -return __vmalloc_node (size,1 ,GFP_KERNEL | __GFP_RETRY_MAYFAIL | flags, - numa_node,__builtin_return_address (0 )); + +return __vmalloc_node_range (size, align,VMALLOC_START ,VMALLOC_END , + gfp |GFP_KERNEL | __GFP_RETRY_MAYFAIL,PAGE_KERNEL , + flags, numa_node,__builtin_return_address (0 )); }void *bpf_map_area_alloc (u64 size,int numa_node)
mm/nommu.c renamed from mm/nommu.c~mm-remove-vmalloc_user_node_flags +8 -6
@@ -150,6 +150,14 @@ void *__vmalloc(unsigned long size, gfp_ }EXPORT_SYMBOL (__vmalloc); +void *__vmalloc_node_range (unsigned long size,unsigned long align, +unsigned long start,unsigned long end,gfp_t gfp_mask, +pgprot_t prot,unsigned long vm_flags,int node, +const void *caller) +{ +return __vmalloc (size, flags); +} +void *__vmalloc_node (unsigned long size,unsigned long align,gfp_t gfp_mask,int node,const void *caller) {
@@ -180,12 +188,6 @@ void *vmalloc_user(unsigned long size) }EXPORT_SYMBOL (vmalloc_user); -void *vmalloc_user_node_flags (unsigned long size,int node,gfp_t flags) -{ -return __vmalloc_user_flags (size, flags | __GFP_ZERO); -} -EXPORT_SYMBOL (vmalloc_user_node_flags); -struct page *vmalloc_to_page (const void *addr) {return virt_to_page (addr);
mm/vmalloc.c renamed from mm/vmalloc.c~mm-remove-vmalloc_user_node_flags +0 -20
@@ -2659,26 +2659,6 @@ void *vzalloc_node(unsigned long size, iEXPORT_SYMBOL (vzalloc_node);/** -* vmalloc_user_node_flags - allocate memory for userspace on a specific node -* @size: allocation size -* @node: numa node -* @flags: flags for the page level allocator -* -* The resulting memory area is zeroed so it can be mapped to userspace -* without leaking data. -* -* Return: pointer to the allocated memory or %NULL on error -*/ -void *vmalloc_user_node_flags (unsigned long size,int node,gfp_t flags) -{ -return __vmalloc_node_range (size,SHMLBA ,VMALLOC_START ,VMALLOC_END , - flags | __GFP_ZERO,PAGE_KERNEL , -VM_USERMAP , node, -__builtin_return_address (0 )); -} -EXPORT_SYMBOL (vmalloc_user_node_flags); - -/** * vmalloc_exec - allocate virtually contiguous, executable memory * @size: allocation size *
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: arm64: use __vmalloc_node in arch_alloc_vmap_stack has been added to the -mm tree. Its filename is arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch
The patch titled
Subject: arm64: use __vmalloc_node in arch_alloc_vmap_stack
has been added to the -mm tree. Its filename is
arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: arm64: use __vmalloc_node in arch_alloc_vmap_stack
arch_alloc_vmap_stack can use a slightly higher level vmalloc function.
---
arch/arm64/include/asm/vmap_stack.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/include/asm/vmap_stack.h renamed from arch/arm64/include/asm/vmap_stack.h~arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack +2 -4
@@ -19,10 +19,8 @@ static inline unsigned long *arch_alloc_ {BUILD_BUG_ON (!IS_ENABLED (CONFIG_VMAP_STACK )); -return __vmalloc_node_range (stack_size,THREAD_ALIGN , -VMALLOC_START ,VMALLOC_END , -THREADINFO_GFP ,PAGE_KERNEL ,0 , node, -__builtin_return_address (0 )); +return __vmalloc_node (stack_size,THREAD_ALIGN ,THREADINFO_GFP , node, +__builtin_return_address (0 )); }#endif /* __ASM_VMAP_STACK_H */
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: powerpc: use __vmalloc_node in alloc_vm_stack has been added to the -mm tree. Its filename is powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch
The patch titled
Subject: powerpc: use __vmalloc_node in alloc_vm_stack
has been added to the -mm tree. Its filename is
powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: powerpc: use __vmalloc_node in alloc_vm_stack
alloc_vm_stack can use a slightly higher level vmalloc function.
---
arch/powerpc/kernel/irq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/kernel/irq.c renamed from arch/powerpc/kernel/irq.c~powerpc-use-__vmalloc_node-in-alloc_vm_stack +2 -3
@@ -748,9 +748,8 @@ void do_IRQ(struct pt_regs *regs)static void *__init alloc_vm_stack (void ) { -return __vmalloc_node_range (THREAD_SIZE ,THREAD_ALIGN ,VMALLOC_START , -VMALLOC_END ,THREADINFO_GFP ,PAGE_KERNEL , -0 ,NUMA_NO_NODE , (void *)_RET_IP_); +return __vmalloc_node (THREAD_SIZE ,THREAD_ALIGN ,THREADINFO_GFP , +NUMA_NO_NODE , (void *)_RET_IP_); }static void __init vmap_irqstack_init (void )
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ s390-use-__vmalloc_node-in-stack_alloc.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: s390: use __vmalloc_node in stack_alloc has been added to the -mm tree. Its filename is
The patch titled
Subject: s390: use __vmalloc_node in stack_alloc
has been added to the -mm tree. Its filename is
s390-use-__vmalloc_node-in-stack_alloc.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/s390-use-__vmalloc_node-in-stack_alloc.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/s390-use-__vmalloc_node-in-stack_alloc.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: s390: use __vmalloc_node in stack_alloc
stack_alloc can use a slightly higher level vmalloc function.
---
arch/s390/kernel/setup.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
arch/s390/kernel/setup.c renamed from arch/s390/kernel/setup.c~s390-use-__vmalloc_node-in-stack_alloc +3 -6
@@ -305,12 +305,9 @@ void *restart_stack __section(.data);unsigned long stack_alloc (void ) {#ifdef CONFIG_VMAP_STACK -return (unsigned long ) -__vmalloc_node_range (THREAD_SIZE ,THREAD_SIZE , -VMALLOC_START ,VMALLOC_END , -THREADINFO_GFP , -PAGE_KERNEL ,0 ,NUMA_NO_NODE , -__builtin_return_address (0 )); +return (unsigned long )__vmalloc_node (THREAD_SIZE ,THREAD_SIZE , +THREADINFO_GFP ,NUMA_NO_NODE , +__builtin_return_address (0 ));#else return __get_free_pages (GFP_KERNEL ,THREAD_SIZE_ORDER );#endif
_
Patches currently in -mm which might be from [email protected] are
x86-hyperv-use-vmalloc_exec-for-the-hypercall-page.patch x86-fix-vmap-arguments-in-map_irq_stack.patch staging-android-ion-use-vmap-instead-of-vm_map_ram.patch staging-media-ipu3-use-vmap-instead-of-reimplementing-it.patch dma-mapping-use-vmap-insted-of-reimplementing-it.patch powerpc-add-an-ioremap_phb-helper.patch powerpc-remove-__ioremap_at-and-__iounmap_at.patch mm-remove-__get_vm_area.patch mm-unexport-unmap_kernel_range_noflush.patch mm-rename-config_pgtable_mapping-to-config_zsmalloc_pgtable_mapping.patch mm-only-allow-page-table-mappings-for-built-in-zsmalloc.patch mm-pass-addr-as-unsigned-long-to-vb_free.patch mm-remove-vmap_page_range_noflush-and-vunmap_page_range.patch mm-rename-vmap_page_range-to-map_kernel_range.patch mm-dont-return-the-number-of-pages-from-map_kernel_range_noflush.patch mm-remove-map_vm_range.patch
mm-remove-unmap_vmap_area.patch mm-remove-the-prot-argument-from-vm_map_ram.patch mm-enforce-that-vmap-cant-map-pages-executable.patch gpu-drm-remove-the-powerpc-hack-in-drm_legacy_sg_alloc.patch mm-remove-the-pgprot-argument-to-__vmalloc.patch mm-remove-the-prot-argument-to-__vmalloc_node.patch mm-remove-both-instances-of-__vmalloc_node_flags.patch mm-remove-__vmalloc_node_flags_caller.patch mm-switch-the-test_vmalloc-module-to-use-__vmalloc_node.patch mm-remove-vmalloc_user_node_flags.patch arm64-use-__vmalloc_node-in-arch_alloc_vmap_stack.patch powerpc-use-__vmalloc_node-in-alloc_vm_stack.patch s390-use-__vmalloc_node-in-stack_alloc.patch
+ test_firmware-remove-unnecessary-test_fw_mutex-in-test_dev_config_show_xxx.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: test_firmware: remove unnecessary test_fw_mutex in test_dev_config_show_xxx has been added to the -mm tree. Its filename is…
The patch titled
Subject: test_firmware: remove unnecessary test_fw_mutex in test_dev_config_show_xxx
has been added to the -mm tree. Its filename is
test_firmware-remove-unnecessary-test_fw_mutex-in-test_dev_config_show_xxx.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/test_firmware-remove-unnecessary-test_fw_mutex-in-test_dev_config_show_xxx.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/test_firmware-remove-unnecessary-test_fw_mutex-in-test_dev_config_show_xxx.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Scott Branden <[email protected]>
Subject: test_firmware: remove unnecessary test_fw_mutex in test_dev_config_show_xxx
Remove unnecessary use of test_fw_mutex in test_dev_config_show_xxx functions that show simple bool, int, and u8.
---
lib/test_firmware.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)
lib/test_firmware.c renamed from lib/test_firmware.c~test_firmware-remove-unnecessary-test_fw_mutex-in-test_dev_config_show_xxx +3 -22
@@ -310,27 +310,13 @@ static int test_dev_config_update_bool(creturn ret; } -static ssize_t -test_dev_config_show_bool (char *buf, -bool config) +static ssize_t test_dev_config_show_bool (char *buf,bool val) { -bool val; - -mutex_lock (&test_fw_mutex); - val = config; -mutex_unlock (&test_fw_mutex); -return snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t test_dev_config_show_int (char *buf,int cfg) +static ssize_t test_dev_config_show_int (char *buf,int val) { -int val; - -mutex_lock (&test_fw_mutex); - val = cfg; -mutex_unlock (&test_fw_mutex); -return snprintf (buf,PAGE_SIZE ,"%d\n" , val); }
@@ -354,14 +340,8 @@ static int test_dev_config_update_u8(conreturn size; } -static ssize_t test_dev_config_show_u8 (char *buf,u8 cfg) +static ssize_t test_dev_config_show_u8 (char *buf,u8 val) { -u8 val; - -mutex_lock (&test_fw_mutex); - val = cfg; -mutex_unlock (&test_fw_mutex);
+ slub-avoid-redzone-when-choosing-freepointer-location.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: slub: avoid redzone when choosing freepointer location has been added to the -mm tree. Its filename is slub-avoid-redzone-when-choosing-freepointer-location.patch
The patch titled
Subject: slub: avoid redzone when choosing freepointer location
has been added to the -mm tree. Its filename is
slub-avoid-redzone-when-choosing-freepointer-location.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/slub-avoid-redzone-when-choosing-freepointer-location.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/slub-avoid-redzone-when-choosing-freepointer-location.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Kees Cook <[email protected]>
Subject: slub: avoid redzone when choosing freepointer location
Marco Elver reported system crashes when booting with "slub_debug=Z". The freepointer location (s->offset) was not taking into account that the "inuse" size that includes the redzone area should not be used by the freelist pointer. Change the calculation to save the area of the object that an inline freepointer may be written into.
---
mm/slub.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
mm/slub.c renamed from mm/slub.c~slub-avoid-redzone-when-choosing-freepointer-location +10 -2
@@ -3533,6 +3533,7 @@ static int calculate_sizes(struct kmem_c {slab_flags_t flags = s->flags;unsigned int size = s->object_size; +unsigned int freepointer_area;unsigned int order;/*
@@ -3541,6 +3542,13 @@ static int calculate_sizes(struct kmem_c* the possible location of the free pointer. */ size =ALIGN (size,sizeof (void *)); +/* +* This is the area of the object where a freepointer can be +* safely written. If redzoning adds more to the inuse size, we +* can't use that portion for writing the freepointer, so +* s->offset must be limited within this for the general case. +*/ + freepointer_area = size;#ifdef CONFIG_SLUB_DEBUG /*
@@ -3582,13 +3590,13 @@ static int calculate_sizes(struct kmem_c*/ s->offset = size; size +=sizeof (void *); - }else if (size >sizeof (void *)) { + }else if (freepointer_area >sizeof (void *)) {/* * Store freelist pointer near middle of object to keep * it away from the edges of the object to avoid small * sized over/underflows from neighboring allocations. */ - s->offset =ALIGN (size /2 ,sizeof (void *)); + s->offset =ALIGN (freepointer_area /2 ,sizeof (void *)); }#ifdef CONFIG_SLUB_DEBUG
_
Patches currently in -mm which might be from [email protected] are
slub-avoid-redzone-when-choosing-freepointer-location.patch
+ mm-shmem-fix-build-without-thp.patch added to -mm tree
In reply to Andrew MortonThe patch titled Subject: mm/shmem: fix build without THP has been added to the -mm tree. Its filename is mm-shmem-fix-build-without-thp.patch
The patch titled
Subject: mm/shmem: fix build without THP
has been added to the -mm tree. Its filename is
mm-shmem-fix-build-without-thp.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-shmem-fix-build-without-thp.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-shmem-fix-build-without-thp.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Hugh Dickins <[email protected]>
Subject: mm/shmem: fix build without THP
Some optimizers don't notice that shmem_punch_compound() is always true (PageTransCompound() being false) without CONFIG_TRANSPARENT_HUGEPAGE=3Dy:
use IS_ENABLED to help them to avoid the BUILD_BUG inside HPAGE_PMD_NR.
g hole")
---
mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c renamed from mm/shmem.c~mm-shmem-fix-build-without-thp +1 -1
@@ -952,7 +952,7 @@ static void shmem_undo_range(struct inodVM_BUG_ON_PAGE (PageWriteback (page), page);if (shmem_punch_compound (page, start, end))truncate_inode_page (mapping, page); -else { +else if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) {/* Wipe the page and don't get stuck */ clear_highpage (page);flush_dcache_page (page);
_
Patches currently in -mm which might be from [email protected] are
mm-shmem-fix-build-without-thp.patch