[rppt:pks/v0.0 25/27] mm/page_alloc.c:5532:9: error: implicit declaration of function 'set_memory_4k'; did you mean 'set_memory_nx'?

From: kernel test robot
Date: Wed Nov 03 2021 - 21:53:37 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git pks/v0.0
head: b1ddb6750818e99c719da2f60b21e5752f43f0e7
commit: c215b60b24418f8dff21de57333f066ebfb30b93 [25/27] mm/page_alloc: add MIGRATE_PTE_MAPPED and __GFP_PTE_MAPPED_2
config: um-x86_64_defconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git/commit/?id=c215b60b24418f8dff21de57333f066ebfb30b93
git remote add rppt https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
git fetch --no-tags rppt pks/v0.0
git checkout c215b60b24418f8dff21de57333f066ebfb30b93
# save the attached .config to linux build tree
make W=1 ARCH=um SUBARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

mm/page_alloc.c:3934:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes]
3934 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
| ^~~~~~~~~~~~~~~~~~~~~~
mm/page_alloc.c: In function '__alloc_pages':
>> mm/page_alloc.c:5532:9: error: implicit declaration of function 'set_memory_4k'; did you mean 'set_memory_nx'? [-Werror=implicit-function-declaration]
5532 | err = set_memory_4k(addr, nr_pages);
| ^~~~~~~~~~~~~
| set_memory_nx
cc1: some warnings being treated as errors


vim +5532 mm/page_alloc.c

5457
5458 /*
5459 * This is the 'heart' of the zoned buddy allocator.
5460 */
5461 struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
5462 nodemask_t *nodemask)
5463 {
5464 struct page *page;
5465 unsigned int alloc_flags = ALLOC_WMARK_LOW;
5466 gfp_t alloc_gfp; /* The gfp_t that was actually used for allocation */
5467 struct alloc_context ac = { };
5468
5469 /*
5470 * There are several places where we assume that the order value is sane
5471 * so bail out early if the request is out of bound.
5472 */
5473 if (unlikely(order >= MAX_ORDER)) {
5474 WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
5475 return NULL;
5476 }
5477
5478 gfp &= gfp_allowed_mask;
5479 /*
5480 * Apply scoped allocation constraints. This is mainly about GFP_NOFS
5481 * resp. GFP_NOIO which has to be inherited for all allocation requests
5482 * from a particular context which has been marked by
5483 * memalloc_no{fs,io}_{save,restore}. And PF_MEMALLOC_PIN which ensures
5484 * movable zones are not used during allocation.
5485 */
5486 gfp = current_gfp_context(gfp);
5487 alloc_gfp = gfp;
5488 if (!prepare_alloc_pages(gfp, order, preferred_nid, nodemask, &ac,
5489 &alloc_gfp, &alloc_flags))
5490 return NULL;
5491
5492 if ((alloc_gfp & __GFP_PTE_MAPPED) && order == 0) {
5493 page = alloc_page_pte_mapped(alloc_gfp);
5494 if (page)
5495 goto out;
5496 }
5497
5498 /*
5499 * Forbid the first pass from falling back to types that fragment
5500 * memory until all local zones are considered.
5501 */
5502 alloc_flags |= alloc_flags_nofragment(ac.preferred_zoneref->zone, gfp);
5503
5504 /* First allocation attempt */
5505 page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
5506 if (likely(page))
5507 goto out;
5508
5509 alloc_gfp = gfp;
5510 ac.spread_dirty_pages = false;
5511
5512 /*
5513 * Restore the original nodemask if it was potentially replaced with
5514 * &cpuset_current_mems_allowed to optimize the fast-path attempt.
5515 */
5516 ac.nodemask = nodemask;
5517
5518 page = __alloc_pages_slowpath(alloc_gfp, order, &ac);
5519
5520 out:
5521 if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT) && page &&
5522 unlikely(__memcg_kmem_charge_page(page, gfp, order) != 0)) {
5523 __free_pages(page, order);
5524 page = NULL;
5525 }
5526
5527 if (gfp & __GFP_PTE_MAPPED_2) {
5528 unsigned long addr = (unsigned long)page_address(page);
5529 unsigned long nr_pages = (1 << order);
5530 int err;
5531
> 5532 err = set_memory_4k(addr, nr_pages);
5533 if (err) {
5534 /* FIXME: reset pageblock migratetype */
5535 /* set_pageblock_migratetype(old_mt) */
5536 __free_pages(page, order);
5537 page = NULL;
5538 }
5539
5540 /* FIXME: should we flush TLB here or later? */
5541 /* flush_tlb_kernel_range(addr, addr + PAGE_SIZE * nr_pages); */
5542 }
5543
5544 trace_mm_page_alloc(page, order, alloc_gfp, ac.migratetype);
5545
5546 return page;
5547 }
5548 EXPORT_SYMBOL(__alloc_pages);
5549

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip