From patchwork Fri Feb 24 14:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 13151286 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 C2921C61DA4 for ; Fri, 24 Feb 2023 14:12:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E07546B0072; Fri, 24 Feb 2023 09:12:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB6156B0073; Fri, 24 Feb 2023 09:12:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7F006B0074; Fri, 24 Feb 2023 09:12:18 -0500 (EST) 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 B5B716B0072 for ; Fri, 24 Feb 2023 09:12:18 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7E3F31C276F for ; Fri, 24 Feb 2023 14:12:18 +0000 (UTC) X-FDA: 80502375156.10.A6BC00E Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf03.hostedemail.com (Postfix) with ESMTP id 18F3720024 for ; Fri, 24 Feb 2023 14:12:13 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=aoIWaACO; spf=pass (imf03.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.120 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677247935; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=8T+GzZnJo9HvWwR7cB+UuEtm1seROOD8Pjk7vAjFfGE=; b=aDJhPz/E38k9vqfrohhGVM0dFuMfQx4NYzkucyuwTbTOjBfX2wkCeRgJvwVuicuixh8789 MTIrOa9Chh3KnxLVsVQKWYz/PS6HKgxIPRkYRrqc21I1qT8buv3npKpDdbppOKfOdHaADX 1QLp5TcFBnKh990lICUQGdDF24rN7Xk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=aoIWaACO; spf=pass (imf03.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.120 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677247935; a=rsa-sha256; cv=none; b=2ejgzxu8i23Vgz1LO5T8Zsy0zauZLHT9g5huqs7wj6x2HGHOP7vdSq7VhAjsucZ1+8pn2f xHK853LOyU2C7yyzOQf5DUc2LOvf+asDeFX9ZFqxGEKT5eZk6dCc/qH1JHwDkFt3YvNo7y 75Lpq5NMct/QVQ3WG6KmnXyBn1uq42k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677247934; x=1708783934; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wbHiZmYpOxEtl62leTc5hC5LH7H7mGhZv9YLmgqKKdE=; b=aoIWaACOIXXCGYUeU/5XMEcGYM0roP4QXTOWF3HgJrgP0DxZzuCqP8b0 Lqluk31lgN2bQLPojIDRnbeaRFfH2R/hTfLPozujXHOWW8e/5cX9lF6oh E8hELvBJTMLAtUx6OYIKFOGaPnVcbYAsn8sthQEP3nYfC1zmUTFSRyDFS wNa65A1OPpM2r85xo0KIf+iDFcPh4qnLoi8maS3aiZONMTbrjInYFaWNl V34LkLI7el0/yq0lUlaXGOPwXE6OiHMvOR8IHSzcp1P7EM1ZRI7zrKfTJ 28W7qpB8EENydbp0/pqj7yXRIWuoRRK645vpwrUDS83iSTJKGhlg02Kgv A==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="332167659" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="332167659" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2023 06:12:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="741684622" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="741684622" Received: from bingqili-mobl2.ccr.corp.intel.com (HELO yhuang6-mobl2.ccr.corp.intel.com) ([10.255.28.19]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2023 06:12:07 -0800 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Hugh Dickins , "Xu, Pengfei" , Christoph Hellwig , Stefan Roesch , Tejun Heo , Xin Hao , Zi Yan , Yang Shi , Baolin Wang , Matthew Wilcox , Mike Kravetz Subject: [PATCH 0/3] migrate_pages: fix deadlock in batched synchronous migration Date: Fri, 24 Feb 2023 22:11:42 +0800 Message-Id: <20230224141145.96814-1-ying.huang@intel.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Stat-Signature: mb55i7gw1w9p3fig6rx8a3ed687xi9e3 X-Rspam-User: X-Rspamd-Queue-Id: 18F3720024 X-Rspamd-Server: rspam06 X-HE-Tag: 1677247933-987562 X-HE-Meta: U2FsdGVkX18wIK+YBTDtI+HnTU69YNohqOvOBIifhlZft06WYcwzQ7zyVptza2LcwOS/uqeAEAzOj5zjx6Anc1hgZHR+lESRQzgTaEciFeGjaStwx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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: Two deadlock bugs were reported for the migrate_pages() batching series. Thanks Hugh and Pengfei. Analysis shows that if we have locked some other folios except the one we are migrating, it's not safe in general to wait synchronously, for example, to wait the writeback to complete or wait to lock the buffer head. So 1/3 fixes the deadlock in a simple way, where the batching support for the synchronous migration is disabled. The change is straightforward and easy to be understood. While 3/3 re-introduce the batching for synchronous migration via trying to migrate asynchronously in batch optimistically, then fall back to migrate synchronously one by one for fail-to-migrate folios. Test shows that this can restore the TLB flushing batching performance for synchronous migration effectively. Best Regards, Huang, Ying