From patchwork Fri Nov 22 23:23:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13883706 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 6E3E2E6ADCB for ; Fri, 22 Nov 2024 23:24:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFFDE6B008C; Fri, 22 Nov 2024 18:24:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D61B26B0093; Fri, 22 Nov 2024 18:24:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB5DA6B0092; Fri, 22 Nov 2024 18:24:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 820B86B008A for ; Fri, 22 Nov 2024 18:24:32 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 30DC8A0891 for ; Fri, 22 Nov 2024 23:24:32 +0000 (UTC) X-FDA: 82815312384.30.D57DFBA Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf21.hostedemail.com (Postfix) with ESMTP id 29E3D1C0007 for ; Fri, 22 Nov 2024 23:24:29 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=l4hso+Ok; spf=pass (imf21.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.177 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=1732317870; 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=VEBVGrksPHjOfc4WHY5YwyTpscFate/a4s+cTyDDYoU=; b=nbrJb2/XSCsHVESQfYyyrYaGlF2MJwgYih3igKEMhvhw4q/vfuHyAIIEbzMDRWDYZeutSl fYr7MCErWC7FqASncTaQ7KvHztPddXt+GYWbC9jOksTt4vvsl1mJJ6th/1qIb92e6Eubxs aOkQpZDOtc9SAtgUiIG+/N8dXKgg+24= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732317870; a=rsa-sha256; cv=none; b=H3vcP/iBxkNI6lz6ETq4oXfYiOvZTBvIi2lCSRS9GCxuMCG2ntpPeB5yQdYNpupbLyS0ng /VSE3e3NoGi9azxzn/rt3PP8uQ4QTEJ4YOXV+tmjyMKJEGPVRh9Q256nL9mb5VYrgKSpdv HaXv7+gG3iW0OK8JS56IcC9oGjUGI6M= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=l4hso+Ok; spf=pass (imf21.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e388c39b2d0so2071770276.0 for ; Fri, 22 Nov 2024 15:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732317869; x=1732922669; 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=VEBVGrksPHjOfc4WHY5YwyTpscFate/a4s+cTyDDYoU=; b=l4hso+Okc9nIrtpKXog7uEtFPq7JMrkNqZrpdxPdti8plhLicQV8KxkZtB/XzMzDHt ZuNT3jV6idt8LhF+iJH9zro/hS5I9cFY3CcMHy84eymZcQX+vd7/8ZJTMijEOKL3/K6d 3CvbuA+80HW5XXQLvkhP74UeAkTupSs6M/mZzPuV+Xg+1Z7RwkC37kLP/ONwvRGnU8fe wJQ++pi2rXTZYu9IZAHJ8LaehKapRLAtrVF7Yru69yttfTE4kPGodVsjq0L7mN2+1FYF 4WTga+E/xVJLIZW7/Aa66iiN2IO7m0GOO2mRj7o9nmdeDZnFsezaOthRQkTIOiQyN5lH FIkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732317869; x=1732922669; 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=VEBVGrksPHjOfc4WHY5YwyTpscFate/a4s+cTyDDYoU=; b=YFymKWKNGaC2IY9N1U1jNKyeGK20de8ATgsIlkPwrFFMf5GycUg4BZ/cgtn6f/pskb /FktAnQboNXoXghUYW4KQ5ygVKpPRWAhzCxXBU8+zv4H91nZe0I917LedZA7csmI/igA nEpzTNxpNNCVMGm/1oZ+8kyAqtOb2oNMbN1a3/zhUSU/jrXoeOm4LX231hU4W4Az6RC4 yuE2bC1C04wkJe2Xi4bLCgto/yDl5WFpLnHq6Y5ZbTvhUOJKj+Fg4ae/8Nnrlyrnl6oV tkhw6JTz1Q9A1jOid5MWe/6f0f5OoMga7OFQqFOqw+1uOgWZ6O6vzJAwJm8gll9MNb2J T2nA== X-Forwarded-Encrypted: i=1; AJvYcCUFXuphpcXOj6E1CdIi2CjLRCvKGBMxUxKKlJ9j0VsDYq+mMYg9PAMLev4HN8VLEJwBxCPUTrvLUg==@kvack.org X-Gm-Message-State: AOJu0YzMdZ3+/SsXEmIAhx+XP4VhmRhqFW+HoVmMpHGUbYDRBAY4PRKf fc3riITVe6Nd+Rx+++MZ3ruhImVaWZKI90qHN+hOlVlSJ6Cu7sYj X-Gm-Gg: ASbGncvlAqYWSMzy5mf0Wo/2XWJLFuL5oe4dVgQAxzXYSNn+m26W2FE0CNY4CIwLJEf SB/M7TffDgICGpvlT46CWoDIh69+QglnXepL2K27JCM6tNG3/hyc+s5TPzSqQm5HRpbeybpbYaP x79ojZITHUXoxePOa+aErxx0hhTgoi1sBUKWAvlFFbMJib8nGblCeacf4jQsbKTcFy+Qm4zPUQG 1p4Qi7IyWWUALTnrAOgktiGwsnKEQsApFKqylwJJtgIVKCV8hF5aNSz+8Adz2JxxVn8e3gU72CP Ct1E/xAWXw== X-Google-Smtp-Source: AGHT+IFqmAlC0SDQCwdmjhSHUlnQkK2XB4yL/Hv+xmhGPIMjC7dibMuwLQyjuqRbligoAGkvKR8vfw== X-Received: by 2002:a25:720b:0:b0:e38:85ec:9f28 with SMTP id 3f1490d57ef6-e38e182add6mr8426271276.25.1732317869472; Fri, 22 Nov 2024 15:24:29 -0800 (PST) Received: from localhost (fwdproxy-nha-114.fbsv.net. [2a03:2880:25ff:72::face:b00c]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e38f609c74esm874073276.35.2024.11.22.15.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 15:24:29 -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, bernd.schubert@fastmail.fm, linux-mm@kvack.org, kernel-team@meta.com Subject: [PATCH v6 4/5] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_INDETERMINATE mappings Date: Fri, 22 Nov 2024 15:23:58 -0800 Message-ID: <20241122232359.429647-5-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241122232359.429647-1-joannelkoong@gmail.com> References: <20241122232359.429647-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 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ohT33oM U1zircnqtiX6AqXJM91lf6j83orXj8z+9ZwKliVsr586NeYwNPQiCZ78CclHEw7UwtU99XWbXUolXzPhpj/gxir6Qu4OBgmCRQrt1+RuKcgkgne9F4KXxRjkNGsFZoqfh8u92Qz8HXS7GxJFQONPKSdVFZ7m+3OT9Ku47K/v/b3CYNKihdG3P+8phn6UewFXaB2sXici3mLIFqRYzXJaYi7mJ+IMJ4QIu11XFkFd0IpXh3hlvUGX4kDKBCqaiYJ7JGrsm1ooHaH3is8S0cWVPrr3oH0evVBDayzjpqTnQJXVoiYuCGrKEOULPM7TP5C3tanLHfBlpkHF7myVbXfLnd0iLYYVpyoaOJWJuowie+kMRuTVa+TUXilFxkWbFyU2K3Md9kls+01MeJlE6fZZZV9/UYg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000102, 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 migrations called in MIGRATE_SYNC mode, skip migrating the folio if it is under writeback and has the AS_WRITEBACK_INDETERMINATE flag set on its mapping. If the AS_WRITEBACK_INDETERMINATE flag is set on the mapping, the writeback may take an indeterminate amount of time to complete, and waits may get stuck. Signed-off-by: Joanne Koong Reviewed-by: Shakeel Butt --- mm/migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index df91248755e4..fe73284e5246 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_indeterminate(src->mapping)) + break; + fallthrough; default: rc = -EBUSY; goto out;