Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1056477lqb; Wed, 17 Apr 2024 21:06:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1HTWyGeJ1RUDLkxK8DlvkEzmT9o3L1mwzbFyOAJNaovoG8GGIUWpmmhYEqai2aIVY0DxP1AUXDhvxANgkWUT2TZgPuvIzIIwTFHx7Hg== X-Google-Smtp-Source: AGHT+IHnmSUx3dP/PrvlwYLvW8/jy/PcfOvb4Zc167VsD0C91J8iF5HWyHCXLVcyoLvJzU4sJBE8 X-Received: by 2002:a05:6a20:12c2:b0:1a7:9fd2:8bbc with SMTP id v2-20020a056a2012c200b001a79fd28bbcmr2201547pzg.26.1713413189480; Wed, 17 Apr 2024 21:06:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713413189; cv=pass; d=google.com; s=arc-20160816; b=n9z1jsHemFNaKdf5fAHmiF7q14wFHTdAafPKFDoFSk6AHWiQKkL/aSPbQ0y45cApJu dGFlaIg+PVs/JJN5QF/aGtSjGOwOZalVFBWnRdu6v0ysB0cByy4fjtnErfvsInVssd// ha5Nnwh6Otzu2/N2c9+dUTcyaddAGHWmB4B0zT19PGdJTj5F1SyYv/tz7wmXTYfJCrXI BUAbMHX7/jq9ttxJiUdCedGXBrIv+osajrbE/ZOoP7RHqZ13eZCBmXQdSCOzJfCVbaMO /E7omS/MzZpXJalSeWM5qFOPoRu5rHnHKS46ZLhUHg3dFVzDciW3wz2exhBIwYa6CGds eGAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=eQh4ImWl/I1yBrXMSRwJoonZ4BB2QnYBFQWwBdSeffk=; fh=v9Uc0Wn6wjglIeA+1bDVz/c+GtBDLszNd6/cahk1Z4o=; b=BpdeDc07JUFv1ObPVB/2e8DZ2R0yFrNWoYrCCu4HYuyZq8Ua6gHU3IcQtl+IcY+pCy wEHt8+mTuB51muqbI5QyO64daG5fSRb52SJYuj0TXKevyPz0nM0pvNBEu9NxC5zh9bAP IIsi0nYLkVvOnFUB234+AoB2YA1oBoWc5gy1T/kaQ86hXHtAYKYhCCbXyU4rqeqoIOWy uf6krQe82CZGIOTqg1aDcg60BBuDz9Y7c/z3FkuhrHGyuG0p3FEwhlQKnmXRIvUQ+GEz Uacnl5z+Mxauc6AW3HWK/BEuYuW/fTmpUFEwLATIFSYp5qwB5YdcUHmJa55sGslzMKVd Eu5g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=PsXgJRCl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=PsXgJRCl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-149492-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149492-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y6-20020a17090322c600b001e455d8e89esi652115plg.485.2024.04.17.21.06.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 21:06:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149492-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=PsXgJRCl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=PsXgJRCl; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-149492-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149492-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 261BFB22744 for ; Thu, 18 Apr 2024 04:05:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E21954BFB; Thu, 18 Apr 2024 04:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="PsXgJRCl"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="lePxpKpb"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="PsXgJRCl"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="lePxpKpb" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DD2954BC3 for ; Thu, 18 Apr 2024 04:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713413126; cv=none; b=FA/va5C9RW6i/lQvvnfgqMcvb11N5fodiFanX75LLqKfzoWkrpY1/vDaSFvFAFGQH1m1yxuaEoi7A8g9j+iuhD2lDIRmcCsAPdqRwrfApAi1T8A1ol/qI0cuTeeJ6dyX3u66zfqGg6RjGlNYP50GF1D3g0iWYg3Vmev9chouX7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713413126; c=relaxed/simple; bh=AIKrkgDgZc0U8yraOKSyiiypL/jLE/WKx7X56cv4TpY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fp8h3XGFbYuSvBdu7BWQa6C/cmL21mFjf9ZERpbESPl6dXZcLc+66RwWv2UzQNUI3sNQr5S0ritZsrGHJ7gC4maqZbYPJDjMtiFdIk1GHU9uagn3LuB4Bee2Nx+Xw/SyYvSUkfcji9NDD4lV8Tz6/1UMLbPXknuq5hXSJCrsKuU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=PsXgJRCl; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=lePxpKpb; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=PsXgJRCl; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=lePxpKpb; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 094253485A; Thu, 18 Apr 2024 04:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1713413120; 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=eQh4ImWl/I1yBrXMSRwJoonZ4BB2QnYBFQWwBdSeffk=; b=PsXgJRClQkJ6a1EgF1RkNTpoKaHUQgVVFwx1YSRSNkLDYhpi6z1SXE3z728KsGJ0DJ0Gsy ZAk3iyGw9TVrivPmlO0Xi6rh9taLhkbtDL10CrY1MHel57YhJG3cU8FDkGPQbVEZwM6OhJ 6a1At7N195X4vgZGyikzGYJPmw9TQvI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1713413120; 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=eQh4ImWl/I1yBrXMSRwJoonZ4BB2QnYBFQWwBdSeffk=; b=lePxpKpbSDpOmSUfB6zGsve4Q6pWaG4fKsavzPM+ickABBxxvc5l5OBtXzgUPC+0QKobjM aAWtxCMaA00MiyDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PsXgJRCl; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=lePxpKpb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1713413120; 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=eQh4ImWl/I1yBrXMSRwJoonZ4BB2QnYBFQWwBdSeffk=; b=PsXgJRClQkJ6a1EgF1RkNTpoKaHUQgVVFwx1YSRSNkLDYhpi6z1SXE3z728KsGJ0DJ0Gsy ZAk3iyGw9TVrivPmlO0Xi6rh9taLhkbtDL10CrY1MHel57YhJG3cU8FDkGPQbVEZwM6OhJ 6a1At7N195X4vgZGyikzGYJPmw9TQvI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1713413120; 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=eQh4ImWl/I1yBrXMSRwJoonZ4BB2QnYBFQWwBdSeffk=; b=lePxpKpbSDpOmSUfB6zGsve4Q6pWaG4fKsavzPM+ickABBxxvc5l5OBtXzgUPC+0QKobjM aAWtxCMaA00MiyDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 86795133A7; Thu, 18 Apr 2024 04:05:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id U7gVHv+bIGbZSgAAD6G6ig (envelope-from ); Thu, 18 Apr 2024 04:05:19 +0000 Date: Thu, 18 Apr 2024 06:05:18 +0200 From: Oscar Salvador To: Miaohe Lin Cc: akpm@linux-foundation.org, muchun.song@linux.dev, david@redhat.com, vbabka@suse.cz, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm/hugetlb: fix DEBUG_LOCKS_WARN_ON(1) when dissolve_free_hugetlb_folio() Message-ID: References: <20240418022000.3524229-1-linmiaohe@huawei.com> <20240418022000.3524229-2-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240418022000.3524229-2-linmiaohe@huawei.com> X-Spam-Flag: NO X-Spam-Score: -3.67 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 094253485A X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.67 / 50.00]; BAYES_HAM(-1.16)[88.84%]; DWL_DNSWL_LOW(-1.00)[suse.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] On Thu, Apr 18, 2024 at 10:19:59AM +0800, Miaohe Lin wrote: > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 26ab9dfc7d63..1da9a14a5513 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1788,7 +1788,8 @@ static void __update_and_free_hugetlb_folio(struct hstate *h, > destroy_compound_gigantic_folio(folio, huge_page_order(h)); > free_gigantic_folio(folio, huge_page_order(h)); > } else { > - INIT_LIST_HEAD(&folio->_deferred_list); > + if (!folio_test_hugetlb(folio)) > + INIT_LIST_HEAD(&folio->_deferred_list); Ok, it took me a bit to figure this out. So we basically init __deferred_list when we know that folio_put will not end up calling free_huge_folio because a previous call to remove_hugetlb_folio has already cleared the bit. Maybe Matthew thought that any folio ending here would not end up in free_huge_folio (which is the one fiddling subpool). I mean, fix looks good because if hugetlb flag is cleared, destroy_large_folio will go straight to free_the_page, but the whole thing is a bit subtle. And if we decide to go with this, I think we are going to need a comment in there explaining what is going on like "only init _deferred_list if free_huge_folio cannot be call". -- Oscar Salvador SUSE Labs