From patchwork Mon Jan 24 05:17:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12721553 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 B940AC433F5 for ; Mon, 24 Jan 2022 05:18:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BA356B0083; Mon, 24 Jan 2022 00:18:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 36B1E6B0085; Mon, 24 Jan 2022 00:18:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20AA26B0087; Mon, 24 Jan 2022 00:18:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 124936B0083 for ; Mon, 24 Jan 2022 00:18:09 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BA5538249980 for ; Mon, 24 Jan 2022 05:18:08 +0000 (UTC) X-FDA: 79064024256.22.13CDC8A Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf28.hostedemail.com (Postfix) with ESMTP id 48A37C0007 for ; Mon, 24 Jan 2022 05:18:08 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id d5so12878990pjk.5 for ; Sun, 23 Jan 2022 21:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kKp2VsYVshLyXdr/Mm5s2c/ypkad29QD2/BMtkuP4rM=; b=KMFMXHj1seUsAKWZF1wx6B80aQgEMVTjVCw3uuJwzlNCa4fehZo82ctufwGRlAx/nE 1Os6wrArlQlVOMsLzUOXbogYGGXyYCXhFJCR6N0818Utleh/fKrubFUP3fBm0Yubg9CE Jg5ag39IA6Ot0T5y35480iUDQddincDphtjn4Dm4W1Q/lQydpeCDai/soZLgzFhdlVt6 atWJMdpe09b8mWmypGUz28vXNQXZtix3LpaGcXxJBusEaBK8PyoHArik4+PhVetiqkFg cEDufP1xSnLPFQCGYVM3OpQbMKq9lil+I9NBrKu5YeY5kVaEr2LwfkBG8+VqHXWZrgpa tcAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kKp2VsYVshLyXdr/Mm5s2c/ypkad29QD2/BMtkuP4rM=; b=BYOh2uvNaGfyzMaZQOYejmd3yNXjiUgmPNXEbPJudcihu7x6xkpFFGP/qbETgjoLj5 04WeEipD6wFQNV/+qGgl9WlTznlrFkv0NEhRsB0lTo3T0cGVl0O+hA6YXCpdoHhylBID i9jJtoBJ63ymYVOcsMp2niwquABJ5P+4fkFb9LqNeHXlVD/saEAskgluEh9626MyV74I DVUV8nkazoDtPjpQWX2ClN/KQwqTeALPE0+3N8+6IpguOMGaL5564vyQONC3YPbmsEXD Eh7Fa0IbBKY2S1gYK5Kj9DhliF9uKgavdaOJwbtYZtMbIp/4EoaNJFX45hpusA1I7gmW 74kA== X-Gm-Message-State: AOAM5337GVvjG9kXpMTbutZUzK18qavQHvdPbCX9sGbeXHykLXfgTfln byAGpMTifMzLqH1D3PAL3ki5KA== X-Google-Smtp-Source: ABdhPJxybSZPlRDINVw0aEX2KARMUBoqgQqXKvdvrZKs+UMQM/WyESYd1/uYYZyNkz5zhJm/v1mvFg== X-Received: by 2002:a17:903:24d:b0:149:b68f:579 with SMTP id j13-20020a170903024d00b00149b68f0579mr13534093plh.1.1643001487395; Sun, 23 Jan 2022 21:18:07 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id l21sm14263018pfu.120.2022.01.23.21.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 21:18:07 -0800 (PST) From: Muchun Song To: akpm@linux-foundation.org, zi.yan@cs.rutgers.edu, kirill.shutemov@linux.intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, duanxiongchun@bytedance.com, Muchun Song Subject: [PATCH v2 2/2] mm: fix missing cache flush for all tail pages of THP Date: Mon, 24 Jan 2022 13:17:52 +0800 Message-Id: <20220124051752.83281-2-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220124051752.83281-1-songmuchun@bytedance.com> References: <20220124051752.83281-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Stat-Signature: ax1ioe838beuaeqbnn8q53jw7tmbpnwe Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=KMFMXHj1; spf=pass (imf28.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 48A37C0007 X-HE-Tag: 1643001488-240226 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: The D-cache maintenance inside move_to_new_page() only consider one page, there is still D-cache maintenance issue for tail pages of THP. Fix this by not using flush_dcache_folio() since it is not backportable. Fixes: 616b8371539a ("mm: thp: enable thp migration in generic path") Signed-off-by: Muchun Song --- Changes in v2: - Using a for loop instead of the folio variant for backportable. mm/migrate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c9296d63878d..c418e8d92b9c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -933,9 +933,12 @@ static int move_to_new_page(struct page *newpage, struct page *page, if (!PageMappingFlags(page)) page->mapping = NULL; - if (likely(!is_zone_device_page(newpage))) - flush_dcache_page(newpage); + if (likely(!is_zone_device_page(newpage))) { + int i, nr = compound_nr(newpage); + for (i = 0; i < nr; i++) + flush_dcache_page(newpage + i); + } } out: return rc;