linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>, linux-mm <linux-mm@kvack.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Mike Rapoport <rppt@linux.vnet.ibm.com>
Subject: [PATCH] mm: make DEFERRED_STRUCT_PAGE_INIT explicitly depend on SPARSEMEM
Date: Fri, 29 Jun 2018 16:35:08 +0300	[thread overview]
Message-ID: <1530279308-24988-1-git-send-email-rppt@linux.vnet.ibm.com> (raw)

The deferred memory initialization relies on section definitions, e.g
PAGES_PER_SECTION, that are only available when CONFIG_SPARSEMEM=y on most
architectures.

Initially DEFERRED_STRUCT_PAGE_INIT depended on explicit
ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT configuration option, but since the
commit 2e3ca40f03bb13709df4 ("mm: relax deferred struct page requirements")
this requirement was relaxed and now it is possible to enable
DEFERRED_STRUCT_PAGE_INIT on architectures that support DISCONTINGMEM and
NO_BOOTMEM which causes build failures.

For instance, setting SMP=y and DEFERRED_STRUCT_PAGE_INIT=y on arc causes
the following build failure:

  CC      mm/page_alloc.o
mm/page_alloc.c: In function 'update_defer_init':
mm/page_alloc.c:321:14: error: 'PAGES_PER_SECTION'
undeclared (first use in this function); did you mean 'USEC_PER_SEC'?
      (pfn & (PAGES_PER_SECTION - 1)) == 0) {
              ^~~~~~~~~~~~~~~~~
              USEC_PER_SEC
mm/page_alloc.c:321:14: note: each undeclared
identifier is reported only once for each function it appears in
In file included from include/linux/cache.h:5:0,
                 from include/linux/printk.h:9,
                 from include/linux/kernel.h:14,
                 from
include/asm-generic/bug.h:18,
                 from
arch/arc/include/asm/bug.h:32,
                 from include/linux/bug.h:5,
                 from include/linux/mmdebug.h:5,
                 from include/linux/mm.h:9,
                 from mm/page_alloc.c:18:
mm/page_alloc.c: In function 'deferred_grow_zone':
mm/page_alloc.c:1624:52: error:
'PAGES_PER_SECTION' undeclared (first use in this function); did you mean
'USEC_PER_SEC'?
  unsigned long nr_pages_needed = ALIGN(1 << order, PAGES_PER_SECTION);
                                                    ^
include/uapi/linux/kernel.h:11:47: note: in
definition of macro '__ALIGN_KERNEL_MASK'
 #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
                                               ^~~~
include/linux/kernel.h:58:22: note: in expansion
of macro '__ALIGN_KERNEL'
 #define ALIGN(x, a)  __ALIGN_KERNEL((x), (a))
                      ^~~~~~~~~~~~~~
mm/page_alloc.c:1624:34: note: in expansion of
macro 'ALIGN'
  unsigned long nr_pages_needed = ALIGN(1 << order, PAGES_PER_SECTION);
                                  ^~~~~
In file included from
include/asm-generic/bug.h:18:0,
                 from
arch/arc/include/asm/bug.h:32,
                 from include/linux/bug.h:5,
                 from include/linux/mmdebug.h:5,
                 from include/linux/mm.h:9,
                 from mm/page_alloc.c:18:
mm/page_alloc.c: In function
'free_area_init_node':
mm/page_alloc.c:6379:50: error:
'PAGES_PER_SECTION' undeclared (first use in this function); did you mean
'USEC_PER_SEC'?
  pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION,
                                                  ^
include/linux/kernel.h:812:22: note: in definition
of macro '__typecheck'
   (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ^
include/linux/kernel.h:836:24: note: in expansion
of macro '__safe_cmp'
  __builtin_choose_expr(__safe_cmp(x, y), \
                        ^~~~~~~~~~
include/linux/kernel.h:904:27: note: in expansion
of macro '__careful_cmp'
 #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
                           ^~~~~~~~~~~~~
mm/page_alloc.c:6379:29: note: in expansion of
macro 'min_t'
  pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION,
                             ^~~~~
include/linux/kernel.h:836:2: error: first
argument to '__builtin_choose_expr' not a constant
  __builtin_choose_expr(__safe_cmp(x, y), \
  ^
include/linux/kernel.h:904:27: note: in expansion
of macro '__careful_cmp'
 #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
                           ^~~~~~~~~~~~~
mm/page_alloc.c:6379:29: note: in expansion of
macro 'min_t'
  pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION,
                             ^~~~~
scripts/Makefile.build:317: recipe for target
'mm/page_alloc.o' failed

Let's make the DEFERRED_STRUCT_PAGE_INIT explicitly depend on SPARSEMEM as
the systems that support DISCONTIGMEM do not seem to have that huge
amounts of memory that would make DEFERRED_STRUCT_PAGE_INIT relevant.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
 mm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index ce95491..94af022 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -635,7 +635,7 @@ config DEFERRED_STRUCT_PAGE_INIT
 	bool "Defer initialisation of struct pages to kthreads"
 	default n
 	depends on NO_BOOTMEM
-	depends on !FLATMEM
+	depends on SPARSEMEM
 	depends on !NEED_PER_CPU_KM
 	help
 	  Ordinarily all struct pages are initialised during early boot in a
-- 
2.7.4


             reply	other threads:[~2018-06-29 13:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 13:35 Mike Rapoport [this message]
2018-06-29 13:48 ` [PATCH] mm: make DEFERRED_STRUCT_PAGE_INIT explicitly depend on SPARSEMEM Michal Hocko
2018-06-29 14:12 ` Pavel Tatashin
2018-06-29 20:24 ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1530279308-24988-1-git-send-email-rppt@linux.vnet.ibm.com \
    --to=rppt@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).