From patchwork Thu Nov 7 19:16:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13866971 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 82D2AD5D683 for ; Thu, 7 Nov 2024 19:17:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCB596B0092; Thu, 7 Nov 2024 14:17:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7D766B0096; Thu, 7 Nov 2024 14:17:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF6166B0098; Thu, 7 Nov 2024 14:17:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 978F56B0092 for ; Thu, 7 Nov 2024 14:17:31 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5035F140A11 for ; Thu, 7 Nov 2024 19:17:31 +0000 (UTC) X-FDA: 82760256894.12.B830F31 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by imf14.hostedemail.com (Postfix) with ESMTP id 8224710001C for ; Thu, 7 Nov 2024 19:16:49 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=G+7YNR0+; spf=pass (imf14.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731006823; 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:in-reply-to:references:references:dkim-signature; bh=MG5iK0PNmiW0m0S9ll/rGoWwCANqU1Z5kMah1Ao73Dk=; b=q9ZmnuI9qA8MxffWybF7oiM04SyGcAycSA9ItjMoPzd9oUFLzvYqJIjqSy4rF/4FUlOdXs x30YM+CDydHG4HuESQlh3sJQfnG6QjTzf5UIBO+3RZZ8E3Q0vPzbhiKBukP6hfW7srwozt +u0zo9kN6aecm8V6fzG9eIhdkuFBSAo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=G+7YNR0+; spf=pass (imf14.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731006823; a=rsa-sha256; cv=none; b=s203Kpz2+bsPpT3dHOA7L4wohgDmRdfy/iTXxApdBi1BSkW7boDDJoObTgAOnyNPEebDPm UWkafod3WIw7C0GLcjtqNOwccBIXCrp68FwHJL0gxqKqpwWgq2H0LQ+YzCVIUrf1Jdv3rX 5BTD03g9KU7hmRWh29ei/5o6FGlJvok= Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e2974743675so1312381276.1 for ; Thu, 07 Nov 2024 11:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731007048; x=1731611848; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MG5iK0PNmiW0m0S9ll/rGoWwCANqU1Z5kMah1Ao73Dk=; b=G+7YNR0+c6xmgbnZH9dQL2T7rh+4NlbybmjHIv+VXUBO0AJWJBSk/U8cjmyonJ/iOn WQMIxr8Nwaax3gSWof6bmZxjap2MmgDZwBkXP7PJuvGFqCpTnCVsRRUOn5RtETXDoson m71wkN1kxAhhftPFeXN0DlcKueXjbgvuPBUIFhgEydKjIYqteASvGGRDh+F0uzpQAjSI cpQyJXR/HTu86QlCw9WCs+0UDbawDBw2gSIOAb3fyRmRBWBVSgxy2faO1fCVZH8vJbiL ZfH8t2+GLfAaKKhYsXQaSFXwJD/mUhuDbdwPyTfW8qSfyKSd2WvinXzcoY1Vw5JzG11A yOOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731007048; x=1731611848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MG5iK0PNmiW0m0S9ll/rGoWwCANqU1Z5kMah1Ao73Dk=; b=qgkHWrgArvmbI6+mLEnCmru/aIRHtBekXiqB93RuekckBJ3eCI4jYg8qC6k4hYPCT7 JXb4BW+HFNEBjj81yLZdYpi3GNtUwhH7KKm5iZcaP3dxsNJaBTP9sc9nqENYsoB8tq/h NyFwAwwiST1IuAuBrweO+io112ejRsQe0mRStwDki3Ec3tTl2MiCKCAuKIIFb2N2MogB bZCIKNyz8KQSSm9hD3uApnkzyAOdm/JDUhwqxhGCu4MLtvXUp7cj3DSYtJn73Ij4CHZr xZygnkAh7s4KlJx8LXuKblWuTNIB61h3RxO1KqSToDLF5NfSVA3mrfdk9H5W1iRH7fKk +ZRw== X-Forwarded-Encrypted: i=1; AJvYcCXtaJ3H8+5U1IlgorEOl8xKerL3JvlRSkBEcWUWrPGzmwIBBWBNw1OfIyPz7oEQaFAOZyc1yNFMzA==@kvack.org X-Gm-Message-State: AOJu0YwU+nXABu6hPJf5G/DLC5LA5zfbcAszMUGAMuRQIVhdIKcW7JuI UruIu5oG9zUnhuWpMml+oDHvXjsL63b0JsHNvCaSieHpMfJRk8bW X-Google-Smtp-Source: AGHT+IFcIlGFpbiDZRAZoKdELB0Ba2H780dbAB8bPQD2I1i+kogNUBV3Xb4R3gifXVFOfN141DB5Gg== X-Received: by 2002:a05:6902:f84:b0:e29:948:69cc with SMTP id 3f1490d57ef6-e337f844097mr171360276.6.1731007048555; Thu, 07 Nov 2024 11:17:28 -0800 (PST) Received: from localhost (fwdproxy-nha-013.fbsv.net. [2a03:2880:25ff:d::face:b00c]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e336f1ba8e5sm386281276.43.2024.11.07.11.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 11:17:28 -0800 (PST) From: Joanne Koong To: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org Cc: shakeel.butt@linux.dev, jefflexu@linux.alibaba.com, josef@toxicpanda.com, linux-mm@kvack.org, bernd.schubert@fastmail.fm, kernel-team@meta.com Subject: [PATCH v3 5/6] mm/migrate: fail MIGRATE_SYNC for folios under writeback with AS_WRITEBACK_MAY_BLOCK mappings Date: Thu, 7 Nov 2024 11:16:16 -0800 Message-ID: <20241107191618.2011146-6-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107191618.2011146-1-joannelkoong@gmail.com> References: <20241107191618.2011146-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8224710001C X-Stat-Signature: 7onfh4e6gkumr9a47orgr3qm8j9c5pxm X-Rspam-User: X-HE-Tag: 1731007009-285813 X-HE-Meta: U2FsdGVkX19hQSQnSx/RROKcDGA3aSBPTi5+RsT0DCpFTYk/1uSrEg+nxM7I+cmuCzIJ8p8vuCUKWY1dYZNn5k3TbwF5IhJgHPrFcjslWjJVvtG3iiXy+HYy9cekeDb57GtvOlvmUeS3YLrNy9mHCYFKNPghrbsV2s8tIMY1s86f41IyyVZ95ZCnz2lXi0k/g+ikLLLIhM69SKGL9aS3G4APRDB05SoGbMifw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MpPj59mhYfOVUIfxm813a2SDwO9ZELLz635u2x0XfdbeaWbryKrVj0VWwO9q3N2Je7NOLAcEdTS/Ip4lq/X1ItGNCo+frTR5Zpnbg13nZ+SKVtygws= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000364, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: For folios with mappings that have the AS_WRITEBACK_MAY_BLOCK flag set on it, fail MIGRATE_SYNC mode migration with -EBUSY if the folio is currently under writeback. If the AS_WRITEBACK_MAY_BLOCK flag is set on the mapping, the writeback may take an indeterminate amount of time to complete, so we cannot wait on writeback. Signed-off-by: Joanne Koong --- mm/migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index df91248755e4..1d038a4202ae 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1260,7 +1260,10 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, */ switch (mode) { case MIGRATE_SYNC: - break; + if (!src->mapping || + !mapping_writeback_may_block(src->mapping)) + break; + fallthrough; default: rc = -EBUSY; goto out;