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 1FD06C7EE23 for ; Mon, 27 Feb 2023 01:26:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7430A6B0072; Sun, 26 Feb 2023 20:26:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F2816B0073; Sun, 26 Feb 2023 20:26:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B9D36B0074; Sun, 26 Feb 2023 20:26:52 -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 4D2466B0072 for ; Sun, 26 Feb 2023 20:26:52 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9B4FEA0478 for ; Mon, 27 Feb 2023 01:26:51 +0000 (UTC) X-FDA: 80511332622.16.79B7BF3 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf15.hostedemail.com (Postfix) with ESMTP id 62602A0008 for ; Mon, 27 Feb 2023 01:26:49 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=fQP3krVL; spf=pass (imf15.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.100 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=1677461209; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SbFB0tR4L6e7oKySo7+L+d/krcC+D2lNbzxY017jSw0=; b=f6MeIzeX0rN84apZnO3kFVbfgMN/CktZp+Q41YRvVi/Tyjo9xDOdzHAXtP8IZ2QdtroUtD giaY3+3OZeMnydx42hadPPAja2XBI5dL02Rq7Qd1J0LTx+eY75U52AgOCr6v0Fyf0S3QZ8 spv6/TeHcXxFv+4AcGyN9wwHRUE8qKU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=fQP3krVL; spf=pass (imf15.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.100 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=1677461209; a=rsa-sha256; cv=none; b=4fl9oSBORqK7JrTtaY6RJiN+1sLIzw88sFvFeAUZO4wXpPIMZ1CG7bALIXzmMwSCP6sVYC jsmpqUHuMi9vGr5rVeOz9gcRxUK/IYuVQdsMpN0N3YhZkqxEIKlSUDfR0+zk+H1WKOVf1C zHQiVDBTe15wRjLa24n0l6FHi1KDyl8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677461209; x=1708997209; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=8ovyPttT18G5v63lM3i6UHd2Y+feRiQ7nfxrWnDWnng=; b=fQP3krVLysJwO0P/Fv7fxrDIujO274pI1d4kMPB+PWNlGy3OwdzKYeGM d3vTFfQ2hTXbDKkOter/BsdjHNu04EyB0cjQ44f+CQYfx6TXu91/8234+ hPqbbysTJeTSAD2s8WwT5r40F1gkTiT5pBbdgnAJ8qjxTXHyFGqx4+ox3 EJpw5CgKbYS11z5nZE634FKrYlXpXte0RfbGa+9g8YDH/i5L2GpM4ZVae rhbc0PzGVlSXkeDpRvFmBr/q4WTPGYc1fynQgYi+YhH1FPkOas7XLsNYQ x5LH0AYKYRVPpj7A2eb4SC7pW/qBJ2c/okbo5R9Ej+mKHPh/+C/dLiSg1 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="398531892" X-IronPort-AV: E=Sophos;i="5.97,330,1669104000"; d="scan'208";a="398531892" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2023 17:26:47 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="816435468" X-IronPort-AV: E=Sophos;i="5.97,330,1669104000"; d="scan'208";a="816435468" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2023 17:26:43 -0800 From: "Huang, Ying" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , "Xu, Pengfei" , Christoph Hellwig , Stefan Roesch , Tejun Heo , Xin Hao , Zi Yan , Yang Shi , Baolin Wang , Matthew Wilcox , Mike Kravetz Subject: Re: [PATCH 0/3] migrate_pages: fix deadlock in batched synchronous migration References: <20230224141145.96814-1-ying.huang@intel.com> <20230225205543.5d56714d2145ac45da25369e@linux-foundation.org> Date: Mon, 27 Feb 2023 09:25:35 +0800 In-Reply-To: <20230225205543.5d56714d2145ac45da25369e@linux-foundation.org> (Andrew Morton's message of "Sat, 25 Feb 2023 20:55:43 -0800") Message-ID: <874jr7dhm8.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 62602A0008 X-Stat-Signature: ski1j33xtid9kdii4zozt3dh99i4o918 X-Rspam-User: X-HE-Tag: 1677461209-147738 X-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KWwu1xaVb8MhEjE5JHOgie8v0yoPDI4N7O9sMpK4XqDkDoFkOKz+Q2l35rOBdKdRJc7FO9KSUoqZ5Voo7P77lcbozZHVcF2j+aN3K6GquI2BNK28QveakyESwv/L6WXyvwUzqOHuB8J0VOLe6pMIqwmiJuEARh7ARhhwp7FHqeYRZHni80OQSeNK7jRLpULAXJJRox6IUV6Ad54ewOtY+dQCW6GE+9AY= 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: Andrew Morton writes: > On Fri, 24 Feb 2023 22:11:42 +0800 Huang Ying wrote: > >> Two deadlock bugs were reported for the migrate_pages() batching >> series. > > "migrate_pages(): batch TLB flushing" Yes. Should have written as that. >> 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. > > If anyone backports the "migrate_pages(): batch TLB flushing" series > into their kernels, they will want to know about such fixes. So we can > help them by providing suitable Link: tags. > > Such a Link: may also be helpful to people who are performing git > bisection searches for some issue but who keep stumbling over the > issues which this series addresses. > > Being lazy, I slapped > > Fixes: 6f7d760e86fa ("migrate_pages: move THP/hugetlb migration support check to simplify code") > > on all three, as this was the final patch in that series. Inaccurate, > but it means that these fixes will land in a suitable place if anyone > needs them. Sorry. I should have added the "Fixes:" tag. I will be more careful in the future. And, I will add proper "Link:" tag too. Best Regards, Huang, Ying