Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2087767lqe; Tue, 9 Apr 2024 09:10:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWazQvcbL6Rhpv3gls83anhLtC4klceJ8Ayr244GBwyqjFi2wEghbPyQh17U6rDGTewU8pQDWqMDJiw8wi/KDXOgIpuStOI0XaA0nCkCg== X-Google-Smtp-Source: AGHT+IGtefsUHaeydKstLdVRPvs5fzScHzNGyv/28Cj1GTMscnw/QOCQBnl5dmMDPqZpQPisrsM9 X-Received: by 2002:a05:620a:cd7:b0:78d:73f4:d1b4 with SMTP id b23-20020a05620a0cd700b0078d73f4d1b4mr117811qkj.39.1712679032751; Tue, 09 Apr 2024 09:10:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712679032; cv=pass; d=google.com; s=arc-20160816; b=Pr7GaKbICKbrMo9Qg1TeyATcLDXfonAP3PDWdB5cscbalIfgVQJZtHhP+9AaK6Qu5h qOMAfrilfz3JungK0woVNDpPhE8qAhuReOE+cGg4ftPuh4X4KYea2hn5DjeMEQBFstb/ p614ms12A9CPG0235Yhs2Rf8H0d1p7tP3l+bRPfaLvtdtzgbliNOl//Viz1KRccM56DQ Zk3ZfoO9XGZHkN1iRCe+k3ijZByxvMxHv51VYWR3hQKi3YmdUWCYs4V/DBs91ftozFS+ uyXS5IBubdDUey09O2L7Svuaod3KHd6/cn1wL/ClBIN1EW0piXKj51S68bexnLxpufw1 Flfw== 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=jXgA26xKibh2o58sqe/B4dfezkEe1t/U2zFmJxz2JwM=; fh=dOqGLk4SDb5qQr8Q3BczncTdFF+f9EHUkf+2WbyZJF8=; b=ZAgH/o0hd/qZ/B9rrhB8cqJyh6UB4IDGYgzsFopKnvdWRixWs+oava9w7ouFbj493s U04piSz9vfA4WnZAPxA8kGzVW3Lkmuol8fycKC0e+o1FmAtYB9Q+7jpnE6uAIvGPoVKJ hGnN5dLli2HLIoricNGwSvFfyjUMsiy7Epdix2PRCG9t1dJ5TPjfy5J2+ZJJIip+8EhN s7dv08ymlrVtja+cfhlSek6D1TfKT8snRHA0san+WOE6505q7QvIPJmFyabSVJW77HYz 2AjwavujglMzKeGgG3xnQPEDoUIhLInlPH7Q3jQG0hoPeUbBAVPExgts6Yo7F85P3mfb GyxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="bd/HlzmU"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="bd/HlzmU"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=lqY1P33Q; 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-137293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h27-20020a05620a13fb00b0078d63afdfc7si5332810qkl.737.2024.04.09.09.10.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 09:10:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="bd/HlzmU"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="bd/HlzmU"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=lqY1P33Q; 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-137293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137293-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 69D8A1C2267E for ; Tue, 9 Apr 2024 16:10:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A64913D899; Tue, 9 Apr 2024 16:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="bd/HlzmU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="lqY1P33Q"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="bd/HlzmU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="lqY1P33Q" 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 9EA2913D886 for ; Tue, 9 Apr 2024 16:10:26 +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=1712679028; cv=none; b=ANwqS63oHpMyjTHknEStaUUFld+Mcy9GovGkdjsPr9GPnE3RVTINPoGXeEVDTcGLBx9AeI9r0AJyx+gr5fbZ9avySn3gYMnh6B9+Grtsu13Op6sYN1B/p4rEnI9OkyYf36I7wNjFGqZMju7pMuiCAW2jxOsl9UvoVWK+NRik4FQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712679028; c=relaxed/simple; bh=GJsoRzq816z9gabZ96VLhbdLIDuom/uboIuzFp+MCF4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pdlc2nodD2VsVfGmhNZWxKNIKl9eB6xcvrqWdjkLc08VG5HQI3JDdHQdQiUMJ00hzS+zbfs+F5ywU/k5jiLAiDO+CQpUDql0ZfoCYiYf7fAwbbiJ8Gld94F5hneCPy9F95eLVH/tkbWzuHDnPnM7XSnObhMIzRQhtyCy9tMGgOc= 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=bd/HlzmU; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=lqY1P33Q; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=bd/HlzmU; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=lqY1P33Q; 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 imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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 9920533ABB; Tue, 9 Apr 2024 16:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712679024; 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=jXgA26xKibh2o58sqe/B4dfezkEe1t/U2zFmJxz2JwM=; b=bd/HlzmUb1UmUPcaoMwg8saPSV75UIqeAfyWXQ6tWimnXIWn7qL2Ews7h78Ce7+jpEasrk NS58DvrXCK6MqQQ5rkxuorUaeUHrfvMvIweF/LPmNITl5rHUjwy2w6sOLPfoClq0pgHwE6 RrIhnpOPsoztiGCT+jc/wgFVrb/+UW8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712679024; 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=jXgA26xKibh2o58sqe/B4dfezkEe1t/U2zFmJxz2JwM=; b=lqY1P33QMvJ12f+QN69G4Kj6wTMJoxsx5RS615NBlpSjSJY03sRq5pjBnDilVvenqyu3Fk BZ497XHlc6TV1RDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712679024; 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=jXgA26xKibh2o58sqe/B4dfezkEe1t/U2zFmJxz2JwM=; b=bd/HlzmUb1UmUPcaoMwg8saPSV75UIqeAfyWXQ6tWimnXIWn7qL2Ews7h78Ce7+jpEasrk NS58DvrXCK6MqQQ5rkxuorUaeUHrfvMvIweF/LPmNITl5rHUjwy2w6sOLPfoClq0pgHwE6 RrIhnpOPsoztiGCT+jc/wgFVrb/+UW8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712679024; 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=jXgA26xKibh2o58sqe/B4dfezkEe1t/U2zFmJxz2JwM=; b=lqY1P33QMvJ12f+QN69G4Kj6wTMJoxsx5RS615NBlpSjSJY03sRq5pjBnDilVvenqyu3Fk BZ497XHlc6TV1RDg== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 446511332F; Tue, 9 Apr 2024 16:10:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id E0DuDXBoFWY7JAAAn2gu4w (envelope-from ); Tue, 09 Apr 2024 16:10:24 +0000 Date: Tue, 9 Apr 2024 18:10:18 +0200 From: Oscar Salvador To: Miaohe Lin Cc: akpm@linux-foundation.org, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/memory-failure: fix deadlock when hugetlb_optimize_vmemmap is enabled Message-ID: References: <20240407085456.2798193-1-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: X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap2.dmz-prg2.suse.org:helo,imap2.dmz-prg2.suse.org:rdns,suse.de:email] X-Spam-Score: -4.30 X-Spam-Flag: NO On Tue, Apr 09, 2024 at 04:10:22PM +0200, Oscar Salvador wrote: > On Sun, Apr 07, 2024 at 04:54:56PM +0800, Miaohe Lin wrote: > > In short, below scene breaks the lock dependency chain: > > > > memory_failure > > __page_handle_poison > > zone_pcp_disable -- lock(pcp_batch_high_lock) > > dissolve_free_huge_page > > __hugetlb_vmemmap_restore_folio > > static_key_slow_dec > > cpus_read_lock -- rlock(cpu_hotplug_lock) > > > > Fix this by calling drain_all_pages() instead. > > > > Signed-off-by: Miaohe Lin > > Acked-by: Oscar Salvador On a second though, disabling pcp via zone_pcp_disable() was a deterministic approach. Now, with drain_all_pages() we drain PCP queues to buddy, but nothing guarantees that those pages do not end up in a PCP queue again before we the call to take_page_off_budy() if we need refilling, right? I guess we can live with that because we will let the system know that we failed to isolate that page. -- Oscar Salvador SUSE Labs