diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 25bbac46605e944bf38dc1e28495fb9dbcf3f139..308a7c8518e8f58865a92c3b89cc136a03008321 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -271,10 +271,10 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries,
 		/*
 		 * Zero out zone modifiers, as we don't have specific zone
 		 * requirements. Keep the flags related to allocation in atomic
-		 * contexts and I/O.
+		 * contexts, I/O, nolockdep.
 		 */
 		alloc_flags &= ~GFP_ZONEMASK;
-		alloc_flags &= (GFP_ATOMIC | GFP_KERNEL);
+		alloc_flags &= (GFP_ATOMIC | GFP_KERNEL | __GFP_NOLOCKDEP);
 		alloc_flags |= __GFP_NOWARN;
 		page = alloc_pages(alloc_flags, STACK_ALLOC_ORDER);
 		if (page)