From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D945AC433FE for ; Mon, 10 Oct 2022 20:45:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21E508E0001; Mon, 10 Oct 2022 16:45:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CD1E6B0073; Mon, 10 Oct 2022 16:45:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0474E8E0001; Mon, 10 Oct 2022 16:45:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E45E06B0071 for ; Mon, 10 Oct 2022 16:45:47 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AC25B14022E for ; Mon, 10 Oct 2022 20:45:47 +0000 (UTC) X-FDA: 80006221134.22.BE090E8 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf29.hostedemail.com (Postfix) with ESMTP id 0E91E12002D for ; Mon, 10 Oct 2022 20:45:46 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 608BB1F947; Mon, 10 Oct 2022 20:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1665434745; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KSEGUILVvyFFP3fbwKQnxW+rZJlTG9J4yuz2e5Q9QpU=; b=R9x4v1Qe6zzAhng3gFD+jQoxjE6qpW6vjWx40ndgy8iKHuh+8kfUXrFxnNBYG7YL1B5eKp 4WLdMO8oSDCZjeK0WRP0E6uVLWR12KqWYYU58Dc3TXJIhATISiz8k+xbJa0BtjRjiHBM6y DmwsT4Zz7WjH3CqcbLUxx2/sSgcSvcY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1665434745; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KSEGUILVvyFFP3fbwKQnxW+rZJlTG9J4yuz2e5Q9QpU=; b=D8zNF/vDoeT9Ehk09ZKEYaUzjqW2Hm05Z2nyOOCYZGsfVzpFJM57qOy2KnQ6t9gpNaJUUv Aoqo9XvQFxZk86DQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E1FCD13ACA; Mon, 10 Oct 2022 20:45:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id awN8NHiERGOcLwAAMHmgww (envelope-from ); Mon, 10 Oct 2022 20:45:44 +0000 Message-ID: Date: Mon, 10 Oct 2022 22:45:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH 1/1] mm/page_alloc: Leave IRQs enabled for per-cpu page allocations Content-Language: en-US To: Mel Gorman , Yu Zhao Cc: Andrew Morton , Nicolas Saenz Julienne , Marcelo Tosatti , Michal Hocko , Hugh Dickins , Marek Szyprowski , LKML , Linux-MM References: <20220824141802.23395-1-mgorman@techsingularity.net> <20221010142208.ctsasloh7hbudupc@techsingularity.net> From: Vlastimil Babka In-Reply-To: <20221010142208.ctsasloh7hbudupc@techsingularity.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665434747; a=rsa-sha256; cv=none; b=L7BBlhTUJq6GrqdeSLm2hnrI6ZBsjntKlya1J+UKfFhXmh46FBKksEWUfAJW+ikyCd9shx klFZEPjWMj3AtleJ2GS4HRlfAR0Zi57ADS+Tks2bWy7FpL6FjCQB5cxbJfgxQ827y7EXfm 3EGBJL2MTGDRqKjSfKInShULkVNp0kU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=R9x4v1Qe; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="D8zNF/vD"; spf=pass (imf29.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665434747; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KSEGUILVvyFFP3fbwKQnxW+rZJlTG9J4yuz2e5Q9QpU=; b=oHqSt+2nNK9eYaRALAQ2DSI8Q7CEI1mL8a3CVx+wCPI88eUq2t2Kbzj/aAYrK7cdNeHPD4 dKimng5MYkrz9kIeBgH5YDEwR8fpI5CCU2XAG/ZcAT9dSe0iuLmYNyKMKdHL67NmurEqSd IdTTPG68Sy3oCiyEUHmVJYKFLSCgjh4= Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=R9x4v1Qe; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="D8zNF/vD"; spf=pass (imf29.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Stat-Signature: kdmfpdsix511rx5zjys5k1siitk1yyuc X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0E91E12002D X-Rspam-User: X-HE-Tag: 1665434746-769430 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 10/10/22 16:22, Mel Gorman wrote: > On Wed, Aug 24, 2022 at 10:58:26PM -0600, Yu Zhao wrote: >> On Wed, Aug 24, 2022 at 8:18 AM Mel Gorman wrote: >>> >>> The pcp_spin_lock_irqsave protecting the PCP lists is IRQ-safe as a task >>> allocating from the PCP must not re-enter the allocator from IRQ context. >>> In each instance where IRQ-reentrancy is possible, the lock is acquired using >>> pcp_spin_trylock_irqsave() even though IRQs are disabled and re-entrancy >>> is impossible. >>> >>> Demote the lock to pcp_spin_lock avoids an IRQ disable/enable in the common >>> case at the cost of some IRQ allocations taking a slower path. If the PCP >>> lists need to be refilled, the zone lock still needs to disable IRQs but >>> that will only happen on PCP refill and drain. If an IRQ is raised when >>> a PCP allocation is in progress, the trylock will fail and fallback to >>> using the buddy lists directly. Note that this may not be a universal win >>> if an interrupt-intensive workload also allocates heavily from interrupt >>> context and contends heavily on the zone->lock as a result. >> >> Hi, >> >> This patch caused the following warning. Please take a look. >> >> Thanks. >> >> WARNING: inconsistent lock state >> 6.0.0-dbg-DEV #1 Tainted: G S W O >> -------------------------------- > > I finally found time to take a closer look at this and I cannot reproduce > it against 6.0. What workload triggered the warning, on what platform and > can you post the kernel config used please? It would also help if you > can remember what git commit the patch was tested upon. > > Thanks and sorry for the long delay. I didn't (try to) reproduce this, but FWIW the report looked legit to me, as after the patch, pcp_spin_trylock() has to be used for both allocation and freeing to be IRQ safe. free_unref_page() uses it, so it's fine. But as the stack trace in the report shows, free_unref_page_list() does pcp_spin_lock() and not _trylock, and that's IMHO the problem.