Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp1004588lko; Tue, 13 Jul 2021 14:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKBya5t6H2ZzboKgda3nLEiIphITMRJRPfoTc+wwjnUONsRDys+klYV3if0FNakRu5oVGi X-Received: by 2002:a17:906:ae4d:: with SMTP id lf13mr8205527ejb.355.1626213367867; Tue, 13 Jul 2021 14:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626213367; cv=none; d=google.com; s=arc-20160816; b=gFdRFVGq/luDEeB4WDjJpZck65h3JNJAexpMLwF+sHfv81EqlgslualLbOtrunLTaN rrT0UnSQEJ9PxLl24kUPobbNQuGuTRvFaZ6VZ4jzPx+Xcddfv6lau4W4IWYwZ7cJzoub bRHzhzXpD4j2auLOB1F9NAFq6o6vGbpjGWHdG/4wXg72v1fufjvhAImNnBgTys1xUF3y R+yU6cGZrVX/VQ7ZJnMp/yn5dXQ4FvHnbV0mItdqG/jSTjC/iSHv6OBPjdnt+tbbytmt wQ+J2fuoirC+FXBJOgkuZywcLPomXSB25Wxw10xLhH7uYy9aRP8Qge7r4PBzlSlU9vdU ub6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=7m7U3YLQAoBrKCVRpaWup9niC4/1FuA9nV56j8TGzHo=; b=vW7K310WIOg+1aOpWgoxIA91Sfa7pf23GlPuMMoqq65webUVwVm4zwXy3NwpOWuLHj vX80a2+lZSOJWRQJOkTnbDC84WFRLzuUTk1hWGr5KhJ6x+tCuUF8ph7O3wsDUUuw30Kf HsKqL1IZ+COyd7KutSMbPT6YTsmahydUAbfd7G+m/rtGbd47nfn5/c6A5XI78bLhoUH/ OvigpIpykGXUACPyU/SmLDoDsxSWhotj5lKE/bO8yyFbc5slOl0oYwGCBbaXbFGslfoj y+fL+UDmqT9S863cSUnNkYD0F4iB3yGGQnuflijkSuyluE8J0v9fCzf3kXStSTlVs7bx Et9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DrYgUv+F; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=RhHSlIPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z69si59822ede.301.2021.07.13.14.55.44; Tue, 13 Jul 2021 14:56:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DrYgUv+F; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=RhHSlIPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235756AbhGMV5l (ORCPT + 99 others); Tue, 13 Jul 2021 17:57:41 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:53490 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234947AbhGMV5l (ORCPT ); Tue, 13 Jul 2021 17:57:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CB2C0228EE; Tue, 13 Jul 2021 21:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1626213289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7m7U3YLQAoBrKCVRpaWup9niC4/1FuA9nV56j8TGzHo=; b=DrYgUv+Ff9O6RxojSf6OLXqqLzvojwJ+DJyZ/3F41l68R6zjiruWKazzGlx4BROIudOemu aumzmHISmjsVsAi3pvlVB2qpwrqqSTgTkBMEHQmeDMyArGBNQc+DRo0vvGnO+M26tDqnLM oeaNQxJqRqvZv3STvgfS8chw0E6Enwo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1626213289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7m7U3YLQAoBrKCVRpaWup9niC4/1FuA9nV56j8TGzHo=; b=RhHSlIPleHyn9FITZ6aQA0EagBnzk1XfscKBPPvyOP7qB9KF4SfxzsabKViqeD7CEnIWyJ DxO5BBjM+iyDaVBg== Received: from suse.de (unknown [10.163.43.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A9455A3B85; Tue, 13 Jul 2021 21:54:48 +0000 (UTC) Date: Tue, 13 Jul 2021 22:54:47 +0100 From: Mel Gorman To: Linus Torvalds Cc: kernel test robot , Uladzislau Rezki , Hillf Danton , Matthew Wilcox , Michal Hocko , Nicholas Piggin , Oleksiy Avramchenko , Steven Rostedt , Andrew Morton , LKML , lkp@lists.01.org, kernel test robot Subject: Re: [mm/vmalloc] 5c1f4e690e: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Message-ID: <20210713215447.GA3741@suse.de> References: <20210713142414.GA28943@xsang-OptiPlex-9020> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 13, 2021 at 11:19:29AM -0700, Linus Torvalds wrote: > On Tue, Jul 13, 2021 at 7:06 AM kernel test robot wrote: > > > > [ 131.014885] BUG: sleeping function called from invalid context at mm/page_alloc.c:4992 > > Strange. The call chain doesn't actually seem to be anything off: it's > writev -> sock_write_iter -> sock_sendmsg -> netlink_sendmsg -> > vmalloc. > > All good to sleep as far as I can tell. The warning itself seems to be just > > might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); > > in prepare_alloc_pages(). > > I don't see what's wrong with that commit, but it does seem to be very > consistent, in that the parent doesn't have it: > It's almost certainly going to be fixed by https://lore.kernel.org/r/20210713152100.10381-2-mgorman@techsingularity.net whenever it hits your tree as part of this series https://lore.kernel.org/lkml/20210713152100.10381-1-mgorman@techsingularity.net/. It should make its way through Andrew's tree before RC2 but if he is busy I'll create a git pull request. > which means that the might_sleep_if() happens _after_ > __alloc_pages_bulk() has disabled interrupts. That would explain it, > but the stack_depot_save() thing actually makes that call chain really > hard to read because it duplicates the addresses on the stack. > > I don't see the nesting there, but that's what it kind of smells like to me. > > Anybody? > The problem is that PAGE_OWNER can recurse allocate from bulk allocation context to store the caller stack. When I wrote the patch, I missed that prep_new_page can allocate if PAGE_OWNER is active. The most relevant part of the trace is [ 131.092667] stack_depot_save+0x390/0x4c0 -- Mel Gorman SUSE Labs