@@ -712,6 +712,13 @@
crossrelease_fullstack
[KNL] Allow to record full stack trace in cross-release
+ lockdep_pagelock=
+ [KNL] Boot-time lockdep_pagelock enabling option.
+ Storage of lockdep_map per page to track lock_page()/
+ unlock_page() is disabled by default. With this switch,
+ we can turn it on.
+ on: enable the feature
+
cryptomgr.notests
[KNL] Disable crypto self-tests
@@ -1185,7 +1185,10 @@ config LOCKDEP_PAGELOCK
select PAGE_EXTENSION
help
PG_locked lock is a kind of crosslock. Using crossrelease feature,
- PG_locked lock can work with lockdep.
+ PG_locked lock can work with lockdep. Even if you include this
+ feature on your build, it is disabled in default. You should pass
+ "lockdep_pagelock=on" to boot parameter in order to enable it. It
+ consumes a fair amount of memory if enabled.
config BOOTPARAM_LOCKDEP_CROSSRELEASE_FULLSTACK
bool "Enable the boot parameter, crossrelease_fullstack"
@@ -1231,8 +1231,24 @@ int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
#ifdef CONFIG_LOCKDEP_PAGELOCK
+static int lockdep_pagelock;
+static int __init allow_lockdep_pagelock(char *str)
+{
+ if (!str)
+ return -EINVAL;
+
+ if (!strcmp(str, "on"))
+ lockdep_pagelock = 1;
+
+ return 0;
+}
+early_param("lockdep_pagelock", allow_lockdep_pagelock);
+
static bool need_lockdep_pagelock(void)
{
+ if (!lockdep_pagelock)
+ return false;
+
return true;
}
@@ -1286,6 +1302,10 @@ static void init_zones_in_node(pg_data_t *pgdat)
static void init_lockdep_pagelock(void)
{
pg_data_t *pgdat;
+
+ if (!lockdep_pagelock)
+ return;
+
for_each_online_pgdat(pgdat)
init_zones_in_node(pgdat);
}
@@ -1305,6 +1325,9 @@ struct lockdep_map *get_page_map(struct page *p)
{
struct page_ext *e;
+ if (!lockdep_pagelock)
+ return NULL;
+
e = lookup_page_ext(p);
if (!e)
return NULL;
To track page locks using lockdep, we need a huge memory space for lockdep_map per page. So, it would be better to make it disabled by default and provide a boot parameter to turn it on. Do it. Suggested-by: Michal Hocko <mhocko@kernel.org> Signed-off-by: Byungchul Park <byungchul.park@lge.com> --- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ lib/Kconfig.debug | 5 ++++- mm/filemap.c | 23 +++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-)