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 9244AC433F5 for ; Tue, 25 Jan 2022 01:56:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F8F46B0081; Mon, 24 Jan 2022 20:56:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A6C66B0083; Mon, 24 Jan 2022 20:56:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56F136B0085; Mon, 24 Jan 2022 20:56:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 46E0B6B0081 for ; Mon, 24 Jan 2022 20:56:27 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E328018338200 for ; Tue, 25 Jan 2022 01:56:26 +0000 (UTC) X-FDA: 79067144772.30.6033953 Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf14.hostedemail.com (Postfix) with ESMTP id A5D46100002 for ; Tue, 25 Jan 2022 01:56:25 +0000 (UTC) Received: by mail-yb1-f180.google.com with SMTP id r65so53584391ybc.11 for ; Mon, 24 Jan 2022 17:56:25 -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:content-transfer-encoding; bh=lHJliPzR279xWRXhqBN4mhw5A2O3eJYJXWRIXm9nJ7U=; b=c4ZrTT0eAdXNGxCG98ZES9L3QEm5taMcchJryHvpEXDGxCvVOiu3C6G6lxqwY4VTeg +hEBfZCBfv44EirmJF5ebHWqlo84cIzOI1qv7F93hN623ipeae4AkA4EOHDlxBpma6i8 3oC9riKAEO3WD13In52b+XIUipp+YCmsjfBbSHRLu4rAzRJMp0zPvMMxtPcRK8mozBAv YR4bj87yyQqxZG2GaJKlPp7fLKve6796XzGnmXSff3aRx8VEfu9vet6Vc8uxD3ciiPJU nRZzIpUkhq9la0IwcCePM1vFat0ZVJZcFY2Nj1yRggdjJ6mOeb+QV6wEGdiY0v5wvKu5 V6NQ== 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:content-transfer-encoding; bh=lHJliPzR279xWRXhqBN4mhw5A2O3eJYJXWRIXm9nJ7U=; b=8K0GqFeCsMCdcoAKG6kLv3sVF+obDrlFpq1BuxqrntNm5FELl7fU1AR5RTaZOzU+EA xr+z1FhTXDHzq87ISKzW5oYz2DYwtixIarC213T7J6ukr4bwXMwLJJ3MNbLoSGAOqcYM oaiPb523xBnivqImm1iUYOBCbA6sUyiTCm7qI3QfXT7NNpsq6VCuH9oiQ85c57Vkbx7j joOrWkOXuh5ngzRZTrZQeSXoE8vV7ac8FonYy55eFx1DXicI9ZzcLm5jm2ZV9Sr9OTzC CijlVs+EQVewQFwUCDcPOM13OMbjqsButIdE1EbkP12Bar4VCr0A576H8ah0hMPjyXPR rGGg== X-Gm-Message-State: AOAM533vF3tr78cPJ0NOUJlHcfbGvs0Jag5AqqAqJ978ege7Zu30AP84 gTXYXdvfAeVNavsMx0ROXEwsjWH/x8VYiUc1uXlVqA== X-Google-Smtp-Source: ABdhPJyi/CJlc+fw5FPZ/8Fg68s6dHRQ87up3INQgfExn142TqnS/ziNQlk5Fgqvs4Fk1AR7Uy6Zx+eJVOg5mx6zbFI= X-Received: by 2002:a25:af4b:: with SMTP id c11mr26452669ybj.49.1643075784723; Mon, 24 Jan 2022 17:56:24 -0800 (PST) MIME-Version: 1.0 References: <20220124051752.83281-1-songmuchun@bytedance.com> <20220124051752.83281-2-songmuchun@bytedance.com> <4d5044e7-cac9-b6e6-1467-59ea6010b0f5@google.com> <5D9B52E1-A74B-4964-AACF-ADB91536C4C0@nvidia.com> In-Reply-To: <5D9B52E1-A74B-4964-AACF-ADB91536C4C0@nvidia.com> From: Muchun Song Date: Tue, 25 Jan 2022 09:55:48 +0800 Message-ID: Subject: Re: [PATCH v2 2/2] mm: fix missing cache flush for all tail pages of THP To: Zi Yan Cc: David Rientjes , Andrew Morton , "Kirill A. Shutemov" , Linux Memory Management List , LKML , Xiongchun duan , Lars Persson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A5D46100002 X-Stat-Signature: fxrghcs1sx31b967w9z3e6m4w5e4bpqc X-Rspam-User: nil Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=c4ZrTT0e; spf=pass (imf14.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1643075785-293651 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, Jan 25, 2022 at 3:22 AM Zi Yan wrote: > > On 24 Jan 2022, at 13:11, David Rientjes wrote: > > > On Mon, 24 Jan 2022, Muchun Song wrote: > > > >> The D-cache maintenance inside move_to_new_page() only consider one pa= ge, > >> there is still D-cache maintenance issue for tail pages of THP. Fix th= is > >> by not using flush_dcache_folio() since it is not backportable. > >> > > > > The mention of being backportable suggests that we should backport this= , > > likely to 4.14+. So should it be marked as stable? > > Hmm, after more digging, I am not sure if the bug exists. For THP migrati= on, > flush_cache_range() is used in remove_migration_pmd(). The flush_dcache_p= age() > was added by Lars Persson (cc=E2=80=99d) to solve the data corruption on = MIPS[1], > but THP migration is only enabled on x86_64, PPC_BOOK3S_64, and ARM64. I only mention the THP case. After some more thinking, I think the HugeTLB should also be considered, Right? The HugeTLB is enabled on arm, arm64, mips, parisc, powerpc, riscv, s390 and sh. > > To make code more consistent, I guess flush_cache_range() in remove_migra= tion_pmd() > can be removed, since it is superseded by the flush_dcache_page() below. >From my point of view, flush_cache_range() in remove_migration_pmd() is a wrong usage, which cannot replace flush_dcache_page(). I think the commit c2cc499c5bcf ("mm compaction: fix of improper cache flush in migration code= ") , which is similar to the situation here, can offer more infos. > > The Fixes can be dropped. Let me know if I miss anything. > > > > > That aside, should there be a follow-up patch that converts to using > > flush_dcache_folio()? > > Are you suggesting to convert just this code or the entire move_to_new_pa= ge() > to use folio? The latter might be more desirable, since the code will be > more consistent. > > > [1] https://lore.kernel.org/all/20190315083502.11849-1-larper@axis.com/T/= #u >