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 7DD31C433F5 for ; Tue, 1 Feb 2022 13:24:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C28616B0159; Tue, 1 Feb 2022 08:24:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD6E56B015A; Tue, 1 Feb 2022 08:24:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC6F36B015B; Tue, 1 Feb 2022 08:24:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay029.a.hostedemail.com [64.99.140.29]) by kanga.kvack.org (Postfix) with ESMTP id 9F1B86B0159 for ; Tue, 1 Feb 2022 08:24:54 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 5FD6080647 for ; Tue, 1 Feb 2022 13:24:54 +0000 (UTC) X-FDA: 79094281308.03.6E4878C Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf22.hostedemail.com (Postfix) with ESMTP id 0587CC0005 for ; Tue, 1 Feb 2022 13:24:51 +0000 (UTC) Received: by mail-yb1-f182.google.com with SMTP id c6so50916115ybk.3 for ; Tue, 01 Feb 2022 05:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hqpudM9UJz8DhfMHsGDhXcBoDji6CUdX20qRejGuIlI=; b=3x9gy11Oeox0rcgJsM027ayhwHe7JM9DmcdtbSgpNwctG0CV7VJyKhto4UfcyPJX1Q hLykpQ2Od4xZdy4o7VTXQW7r+bY9MIU4B8uwiBKM2Yj6ZMw+ROIucztbwR555VbGpauu XJXsgXG+Tdd3SEhlBUQVuDfl6BqtMJ529XLHCUrjUXfTPImzR0NYB5ZqNPxDcEKFeByk EMl5l+0rzYqQBN4WuMxjVTUqhBxldEWR0nunRJkJKkzrx8cT46GMDSdZBxpkJjF80AyP G/NVfODh5PHSS2vb8vGTlvtw34uY0OBPKkU+umpr3xrAdV3gxHeuoHju5ZLYBGObJ9NR c34w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hqpudM9UJz8DhfMHsGDhXcBoDji6CUdX20qRejGuIlI=; b=J+QbP29gln2uz6VGTBOc8Bbh9PaenTvoEOo3rp6Shg4Y6EuUQ5z9uvkmKohg3xHh6L tgZhMJ5PGfHgmYtZgckgAlfVTgNAoYpYBVEtQ4gkka8bO4XuXIS1z2RpU0ldmqPYHV1T 5X4D5YpiKLqRFgF+CYbaeAikIia0xReUXtttqqBhDjYRkZ5uVqlxUsMbdXq1V7zgzC13 +5tAfQfYM/F3QgQZpXTIm4nPwlj27sK8iaAcPfRaRdb/QcCf/PkTg/R/1IkZZqqilpuv kRE+jNip8Le4awug0WNAdnb5dj/469IMvxK0TaVU2MTDdYWiQssPG58u3T0LxXMAZwca ANDA== X-Gm-Message-State: AOAM533q7FhOyj4RKRVG/rSAydlMx0GVGwqbvy2jrRLLpgiG36nT/akt uoNVNre/bPQrxEvjRGzo9n5e8rELEbtoEotvs21v2A== X-Google-Smtp-Source: ABdhPJw1pxurtd45w8gTXxi1nf+fzoGVxQGLkvmNzbsa0qcm/oXG9p/hnUkszP0F97RXEMg8phd27jogNWmncmXBHMY= X-Received: by 2002:a25:c983:: with SMTP id z125mr37208695ybf.132.1643721890972; Tue, 01 Feb 2022 05:24:50 -0800 (PST) MIME-Version: 1.0 References: <20220131160254.43211-1-songmuchun@bytedance.com> <20220131160254.43211-3-songmuchun@bytedance.com> In-Reply-To: <20220131160254.43211-3-songmuchun@bytedance.com> From: Muchun Song Date: Tue, 1 Feb 2022 21:24:12 +0800 Message-ID: Subject: Re: [PATCH v3 2/5] mm: fix missing cache flush for all tail pages of compound page To: Andrew Morton , zi.yan@cs.rutgers.edu, "Kirill A. Shutemov" , David Rientjes , Lars Persson , Mike Kravetz Cc: Linux Memory Management List , LKML , Xiongchun duan , Zi Yan Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: qs81sgj9xh9h7h4ymx4saer6i8sw57j1 X-Rspam-User: nil Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=3x9gy11O; spf=pass (imf22.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0587CC0005 X-HE-Tag: 1643721891-133267 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: On Tue, Feb 1, 2022 at 12:04 AM Muchun Song wrote: > > The D-cache maintenance inside move_to_new_page() only consider one page, > there is still D-cache maintenance issue for tail pages of compound page > (e.g. THP or HugeTLB). THP migration is only enabled on x86_64, ARM64 > and powerpc, while powerpc and arm64 need to maintain the consistency > between I-Cache and D-Cache, which depends on flush_dcache_page() to > maintain the consistency between I-Cache and D-Cache. In theory, the > issue can be found on arm64 and powerpc. My bad. I have looked at the code closely on arm64 and powerpc. There should be no issues since their icache flushing function already considers the compound pages. I'll update the commit log in the next version. > HugeTLB migration is enabled > on arm, arm64, mips, parisc, powerpc, riscv, s390 and sh, while arm > has handled the compound page cache flush in flush_dcache_page(), but > most others do not. In theory, the issue exists on many architectures. > Fix this by not using flush_dcache_folio() since it is not backportable. > > Fixes: 616b8371539a ("mm: thp: enable thp migration in generic path") This Fixes tag will be removed in the next version. > Fixes: 290408d4a250 ("hugetlb: hugepage migration core") > Signed-off-by: Muchun Song > Reviewed-by: Zi Yan