* [PATCH 1/2] filemap: Add mapping_read_folio_gfp()
@ 2023-02-06 16:25 Matthew Wilcox (Oracle)
2023-02-06 16:25 ` [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp() Matthew Wilcox (Oracle)
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-02-06 16:25 UTC (permalink / raw)
To: akpm, hughd, willy, markhemm, rientjes, surenb, shakeelb, mhocko,
vbabka, quic_pkondeti
Cc: linux-mm, linux-kernel, Charan Teja Kalla
This is like read_cache_page_gfp() except it returns the folio instead
of the precise page.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/pagemap.h | 2 ++
mm/filemap.c | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 47069662f4b8..cf0677419981 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -758,6 +758,8 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
struct folio *read_cache_folio(struct address_space *, pgoff_t index,
filler_t *filler, struct file *file);
+struct folio *mapping_read_folio_gfp(struct address_space *, pgoff_t index,
+ gfp_t flags);
struct page *read_cache_page(struct address_space *, pgoff_t index,
filler_t *filler, struct file *file);
extern struct page * read_cache_page_gfp(struct address_space *mapping,
diff --git a/mm/filemap.c b/mm/filemap.c
index 992554c18f1f..2ebcf500871d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3585,6 +3585,30 @@ struct folio *read_cache_folio(struct address_space *mapping, pgoff_t index,
}
EXPORT_SYMBOL(read_cache_folio);
+/**
+ * mapping_read_folio_gfp - Read into page cache, using specified allocation flags.
+ * @mapping: The address_space for the folio.
+ * @index: The index that the allocated folio will contain.
+ * @gfp: The page allocator flags to use if allocating.
+ *
+ * This is the same as "read_cache_folio(mapping, index, NULL, NULL)", but with
+ * any new memory allocations done using the specified allocation flags.
+ *
+ * The most likely error from this function is EIO, but ENOMEM is
+ * possible and so is EINTR. If ->read_folio returns another error,
+ * that will be returned to the caller.
+ *
+ * The function expects mapping->invalidate_lock to be already held.
+ *
+ * Return: Uptodate folio on success, ERR_PTR() on failure.
+ */
+struct folio *mapping_read_folio_gfp(struct address_space *mapping,
+ pgoff_t index, gfp_t gfp)
+{
+ return do_read_cache_folio(mapping, index, NULL, NULL, gfp);
+}
+EXPORT_SYMBOL(mapping_read_folio_gfp);
+
static struct page *do_read_cache_page(struct address_space *mapping,
pgoff_t index, filler_t *filler, struct file *file, gfp_t gfp)
{
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp()
2023-02-06 16:25 [PATCH 1/2] filemap: Add mapping_read_folio_gfp() Matthew Wilcox (Oracle)
@ 2023-02-06 16:25 ` Matthew Wilcox (Oracle)
2023-02-06 18:56 ` kernel test robot
2023-02-06 21:19 ` kernel test robot
0 siblings, 2 replies; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-02-06 16:25 UTC (permalink / raw)
To: akpm, hughd, willy, markhemm, rientjes, surenb, shakeelb, mhocko,
vbabka, quic_pkondeti
Cc: linux-mm, linux-kernel, Charan Teja Kalla
These are the folio replacements for shmem_read_mapping_page()
and shmem_read_mapping_page_gfp().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/shmem_fs.h | 8 ++++++++
mm/shmem.c | 34 +++++++++++++++++++++-------------
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index d09d54be4ffd..103d1000a5a2 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -109,6 +109,14 @@ enum sgp_type {
int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop,
enum sgp_type sgp);
+struct folio *shmem_read_folio_gfp(struct address_space *mapping,
+ pgoff_t index, gfp_t gfp);
+
+static inline struct folio *shmem_read_folio(struct address_space *mapping,
+ pgoff_t index)
+{
+ return shmem_read_folio_gfp(mapping, index, mapping_gfp_mask(mapping));
+}
static inline struct page *shmem_read_mapping_page(
struct address_space *mapping, pgoff_t index)
diff --git a/mm/shmem.c b/mm/shmem.c
index 28f3c699c8ce..d333deddc2b9 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4320,9 +4320,9 @@ int shmem_zero_setup(struct vm_area_struct *vma)
}
/**
- * shmem_read_mapping_page_gfp - read into page cache, using specified page allocation flags.
- * @mapping: the page's address_space
- * @index: the page index
+ * shmem_read_folio_gfp - read into page cache, using specified page allocation flags.
+ * @mapping: the folio's address_space
+ * @index: the folio index
* @gfp: the page allocator flags to use if allocating
*
* This behaves as a tmpfs "read_cache_page_gfp(mapping, index, gfp)",
@@ -4334,13 +4334,12 @@ int shmem_zero_setup(struct vm_area_struct *vma)
* i915_gem_object_get_pages_gtt() mixes __GFP_NORETRY | __GFP_NOWARN in
* with the mapping_gfp_mask(), to avoid OOMing the machine unnecessarily.
*/
-struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
- pgoff_t index, gfp_t gfp)
+struct folio *shmem_read_folio_gfp(struct address_space *mapping,
+ pgoff_t index, gfp_t gfp)
{
#ifdef CONFIG_SHMEM
struct inode *inode = mapping->host;
struct folio *folio;
- struct page *page;
int error;
BUG_ON(!shmem_mapping(mapping));
@@ -4350,18 +4349,27 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
return ERR_PTR(error);
folio_unlock(folio);
- page = folio_file_page(folio, index);
+ return folio;
+#else
+ /*
+ * The tiny !SHMEM case uses ramfs without swap
+ */
+ return mapping_read_folio_gfp(mapping, index, gfp);
+#endif
+}
+EXPORT_SYMBOL_GPL(shmem_read_folio_gfp);
+
+struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
+ pgoff_t index, gfp_t gfp)
+{
+ struct folio *folio = shmem_read_folio_gfp(mapping, index, gfp);
+ struct page *page = folio_file_page(folio, index);
+
if (PageHWPoison(page)) {
folio_put(folio);
return ERR_PTR(-EIO);
}
return page;
-#else
- /*
- * The tiny !SHMEM case uses ramfs without swap
- */
- return read_cache_page_gfp(mapping, index, gfp);
-#endif
}
EXPORT_SYMBOL_GPL(shmem_read_mapping_page_gfp);
--
2.35.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp()
2023-02-06 16:25 ` [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp() Matthew Wilcox (Oracle)
@ 2023-02-06 18:56 ` kernel test robot
2023-02-06 21:19 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2023-02-06 18:56 UTC (permalink / raw)
To: Matthew Wilcox (Oracle),
akpm, hughd, markhemm, rientjes, surenb, shakeelb, mhocko,
vbabka, quic_pkondeti
Cc: oe-kbuild-all, linux-mm, linux-kernel, Charan Teja Kalla
Hi Matthew,
I love your patch! Perhaps something to improve:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.2-rc7 next-20230206]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/shmem-Add-shmem_read_folio-and-shmem_read_folio_gfp/20230207-002746
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230206162520.4029022-2-willy%40infradead.org
patch subject: [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp()
config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20230207/202302070249.AUvSISRY-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ceb56c1ceea709ec0b10ed07e327bb4ae566bba5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Matthew-Wilcox-Oracle/shmem-Add-shmem_read_folio-and-shmem_read_folio_gfp/20230207-002746
git checkout ceb56c1ceea709ec0b10ed07e327bb4ae566bba5
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
mm/shmem.c:4164:13: warning: no previous prototype for 'shmem_init' [-Wmissing-prototypes]
4164 | void __init shmem_init(void)
| ^~~~~~~~~~
mm/shmem.c:4172:5: warning: no previous prototype for 'shmem_unuse' [-Wmissing-prototypes]
4172 | int shmem_unuse(unsigned int type)
| ^~~~~~~~~~~
mm/shmem.c:4177:5: warning: no previous prototype for 'shmem_lock' [-Wmissing-prototypes]
4177 | int shmem_lock(struct file *file, int lock, struct ucounts *ucounts)
| ^~~~~~~~~~
mm/shmem.c:4182:6: warning: no previous prototype for 'shmem_unlock_mapping' [-Wmissing-prototypes]
4182 | void shmem_unlock_mapping(struct address_space *mapping)
| ^~~~~~~~~~~~~~~~~~~~
mm/shmem.c:4187:15: warning: no previous prototype for 'shmem_get_unmapped_area' [-Wmissing-prototypes]
4187 | unsigned long shmem_get_unmapped_area(struct file *file,
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/shmem.c:4195:6: warning: no previous prototype for 'shmem_truncate_range' [-Wmissing-prototypes]
4195 | void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
| ^~~~~~~~~~~~~~~~~~~~
mm/shmem.c:4255:14: warning: no previous prototype for 'shmem_kernel_file_setup' [-Wmissing-prototypes]
4255 | struct file *shmem_kernel_file_setup(const char *name, loff_t size, unsigned long flags)
| ^~~~~~~~~~~~~~~~~~~~~~~
mm/shmem.c:4266:14: warning: no previous prototype for 'shmem_file_setup' [-Wmissing-prototypes]
4266 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
| ^~~~~~~~~~~~~~~~
mm/shmem.c:4279:14: warning: no previous prototype for 'shmem_file_setup_with_mnt' [-Wmissing-prototypes]
4279 | struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt, const char *name,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
mm/shmem.c:4290:5: warning: no previous prototype for 'shmem_zero_setup' [-Wmissing-prototypes]
4290 | int shmem_zero_setup(struct vm_area_struct *vma)
| ^~~~~~~~~~~~~~~~
>> mm/shmem.c:4328:15: warning: no previous prototype for 'shmem_read_folio_gfp' [-Wmissing-prototypes]
4328 | struct folio *shmem_read_folio_gfp(struct address_space *mapping,
| ^~~~~~~~~~~~~~~~~~~~
mm/shmem.c:4353:14: warning: no previous prototype for 'shmem_read_mapping_page_gfp' [-Wmissing-prototypes]
4353 | struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/shmem_read_folio_gfp +4328 mm/shmem.c
4259
4260 /**
4261 * shmem_file_setup - get an unlinked file living in tmpfs
4262 * @name: name for dentry (to be seen in /proc/<pid>/maps
4263 * @size: size to be set for the file
4264 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
4265 */
> 4266 struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
4267 {
4268 return __shmem_file_setup(shm_mnt, name, size, flags, 0);
4269 }
4270 EXPORT_SYMBOL_GPL(shmem_file_setup);
4271
4272 /**
4273 * shmem_file_setup_with_mnt - get an unlinked file living in tmpfs
4274 * @mnt: the tmpfs mount where the file will be created
4275 * @name: name for dentry (to be seen in /proc/<pid>/maps
4276 * @size: size to be set for the file
4277 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
4278 */
4279 struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt, const char *name,
4280 loff_t size, unsigned long flags)
4281 {
4282 return __shmem_file_setup(mnt, name, size, flags, 0);
4283 }
4284 EXPORT_SYMBOL_GPL(shmem_file_setup_with_mnt);
4285
4286 /**
4287 * shmem_zero_setup - setup a shared anonymous mapping
4288 * @vma: the vma to be mmapped is prepared by do_mmap
4289 */
4290 int shmem_zero_setup(struct vm_area_struct *vma)
4291 {
4292 struct file *file;
4293 loff_t size = vma->vm_end - vma->vm_start;
4294
4295 /*
4296 * Cloning a new file under mmap_lock leads to a lock ordering conflict
4297 * between XFS directory reading and selinux: since this file is only
4298 * accessible to the user through its mapping, use S_PRIVATE flag to
4299 * bypass file security, in the same way as shmem_kernel_file_setup().
4300 */
4301 file = shmem_kernel_file_setup("dev/zero", size, vma->vm_flags);
4302 if (IS_ERR(file))
4303 return PTR_ERR(file);
4304
4305 if (vma->vm_file)
4306 fput(vma->vm_file);
4307 vma->vm_file = file;
4308 vma->vm_ops = &shmem_anon_vm_ops;
4309
4310 return 0;
4311 }
4312
4313 /**
4314 * shmem_read_folio_gfp - read into page cache, using specified page allocation flags.
4315 * @mapping: the folio's address_space
4316 * @index: the folio index
4317 * @gfp: the page allocator flags to use if allocating
4318 *
4319 * This behaves as a tmpfs "read_cache_page_gfp(mapping, index, gfp)",
4320 * with any new page allocations done using the specified allocation flags.
4321 * But read_cache_page_gfp() uses the ->read_folio() method: which does not
4322 * suit tmpfs, since it may have pages in swapcache, and needs to find those
4323 * for itself; although drivers/gpu/drm i915 and ttm rely upon this support.
4324 *
4325 * i915_gem_object_get_pages_gtt() mixes __GFP_NORETRY | __GFP_NOWARN in
4326 * with the mapping_gfp_mask(), to avoid OOMing the machine unnecessarily.
4327 */
> 4328 struct folio *shmem_read_folio_gfp(struct address_space *mapping,
4329 pgoff_t index, gfp_t gfp)
4330 {
4331 #ifdef CONFIG_SHMEM
4332 struct inode *inode = mapping->host;
4333 struct folio *folio;
4334 int error;
4335
4336 BUG_ON(!shmem_mapping(mapping));
4337 error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE,
4338 gfp, NULL, NULL, NULL);
4339 if (error)
4340 return ERR_PTR(error);
4341
4342 folio_unlock(folio);
4343 return folio;
4344 #else
4345 /*
4346 * The tiny !SHMEM case uses ramfs without swap
4347 */
4348 return mapping_read_folio_gfp(mapping, index, gfp);
4349 #endif
4350 }
4351 EXPORT_SYMBOL_GPL(shmem_read_folio_gfp);
4352
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp()
2023-02-06 16:25 ` [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp() Matthew Wilcox (Oracle)
2023-02-06 18:56 ` kernel test robot
@ 2023-02-06 21:19 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2023-02-06 21:19 UTC (permalink / raw)
To: Matthew Wilcox (Oracle),
akpm, hughd, markhemm, rientjes, surenb, shakeelb, mhocko,
vbabka, quic_pkondeti
Cc: llvm, oe-kbuild-all, linux-mm, linux-kernel, Charan Teja Kalla
Hi Matthew,
I love your patch! Perhaps something to improve:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.2-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/shmem-Add-shmem_read_folio-and-shmem_read_folio_gfp/20230207-002746
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230206162520.4029022-2-willy%40infradead.org
patch subject: [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp()
config: riscv-randconfig-r023-20230205 (https://download.01.org/0day-ci/archive/20230207/202302070525.Ho0cFITJ-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/ceb56c1ceea709ec0b10ed07e327bb4ae566bba5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Matthew-Wilcox-Oracle/shmem-Add-shmem_read_folio-and-shmem_read_folio_gfp/20230207-002746
git checkout ceb56c1ceea709ec0b10ed07e327bb4ae566bba5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
mm/shmem.c:4164:13: warning: no previous prototype for function 'shmem_init' [-Wmissing-prototypes]
void __init shmem_init(void)
^
mm/shmem.c:4164:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init shmem_init(void)
^
static
mm/shmem.c:4172:5: warning: no previous prototype for function 'shmem_unuse' [-Wmissing-prototypes]
int shmem_unuse(unsigned int type)
^
mm/shmem.c:4172:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int shmem_unuse(unsigned int type)
^
static
mm/shmem.c:4177:5: warning: no previous prototype for function 'shmem_lock' [-Wmissing-prototypes]
int shmem_lock(struct file *file, int lock, struct ucounts *ucounts)
^
mm/shmem.c:4177:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int shmem_lock(struct file *file, int lock, struct ucounts *ucounts)
^
static
mm/shmem.c:4182:6: warning: no previous prototype for function 'shmem_unlock_mapping' [-Wmissing-prototypes]
void shmem_unlock_mapping(struct address_space *mapping)
^
mm/shmem.c:4182:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void shmem_unlock_mapping(struct address_space *mapping)
^
static
mm/shmem.c:4187:15: warning: no previous prototype for function 'shmem_get_unmapped_area' [-Wmissing-prototypes]
unsigned long shmem_get_unmapped_area(struct file *file,
^
mm/shmem.c:4187:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
unsigned long shmem_get_unmapped_area(struct file *file,
^
static
mm/shmem.c:4195:6: warning: no previous prototype for function 'shmem_truncate_range' [-Wmissing-prototypes]
void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
^
mm/shmem.c:4195:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
^
static
mm/shmem.c:4255:14: warning: no previous prototype for function 'shmem_kernel_file_setup' [-Wmissing-prototypes]
struct file *shmem_kernel_file_setup(const char *name, loff_t size, unsigned long flags)
^
mm/shmem.c:4255:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct file *shmem_kernel_file_setup(const char *name, loff_t size, unsigned long flags)
^
static
mm/shmem.c:4266:14: warning: no previous prototype for function 'shmem_file_setup' [-Wmissing-prototypes]
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
^
mm/shmem.c:4266:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
^
static
mm/shmem.c:4279:14: warning: no previous prototype for function 'shmem_file_setup_with_mnt' [-Wmissing-prototypes]
struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt, const char *name,
^
mm/shmem.c:4279:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct file *shmem_file_setup_with_mnt(struct vfsmount *mnt, const char *name,
^
static
mm/shmem.c:4290:5: warning: no previous prototype for function 'shmem_zero_setup' [-Wmissing-prototypes]
int shmem_zero_setup(struct vm_area_struct *vma)
^
mm/shmem.c:4290:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int shmem_zero_setup(struct vm_area_struct *vma)
^
static
>> mm/shmem.c:4328:15: warning: no previous prototype for function 'shmem_read_folio_gfp' [-Wmissing-prototypes]
struct folio *shmem_read_folio_gfp(struct address_space *mapping,
^
mm/shmem.c:4328:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct folio *shmem_read_folio_gfp(struct address_space *mapping,
^
static
mm/shmem.c:4353:14: warning: no previous prototype for function 'shmem_read_mapping_page_gfp' [-Wmissing-prototypes]
struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
^
mm/shmem.c:4353:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
^
static
12 warnings generated.
vim +/shmem_read_folio_gfp +4328 mm/shmem.c
4312
4313 /**
4314 * shmem_read_folio_gfp - read into page cache, using specified page allocation flags.
4315 * @mapping: the folio's address_space
4316 * @index: the folio index
4317 * @gfp: the page allocator flags to use if allocating
4318 *
4319 * This behaves as a tmpfs "read_cache_page_gfp(mapping, index, gfp)",
4320 * with any new page allocations done using the specified allocation flags.
4321 * But read_cache_page_gfp() uses the ->read_folio() method: which does not
4322 * suit tmpfs, since it may have pages in swapcache, and needs to find those
4323 * for itself; although drivers/gpu/drm i915 and ttm rely upon this support.
4324 *
4325 * i915_gem_object_get_pages_gtt() mixes __GFP_NORETRY | __GFP_NOWARN in
4326 * with the mapping_gfp_mask(), to avoid OOMing the machine unnecessarily.
4327 */
> 4328 struct folio *shmem_read_folio_gfp(struct address_space *mapping,
4329 pgoff_t index, gfp_t gfp)
4330 {
4331 #ifdef CONFIG_SHMEM
4332 struct inode *inode = mapping->host;
4333 struct folio *folio;
4334 int error;
4335
4336 BUG_ON(!shmem_mapping(mapping));
4337 error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE,
4338 gfp, NULL, NULL, NULL);
4339 if (error)
4340 return ERR_PTR(error);
4341
4342 folio_unlock(folio);
4343 return folio;
4344 #else
4345 /*
4346 * The tiny !SHMEM case uses ramfs without swap
4347 */
4348 return mapping_read_folio_gfp(mapping, index, gfp);
4349 #endif
4350 }
4351 EXPORT_SYMBOL_GPL(shmem_read_folio_gfp);
4352
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-06 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 16:25 [PATCH 1/2] filemap: Add mapping_read_folio_gfp() Matthew Wilcox (Oracle)
2023-02-06 16:25 ` [PATCH 2/2] shmem: Add shmem_read_folio() and shmem_read_folio_gfp() Matthew Wilcox (Oracle)
2023-02-06 18:56 ` kernel test robot
2023-02-06 21:19 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox