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 X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FA5EC432BE for ; Tue, 27 Jul 2021 13:39:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 08E8161A7F for ; Tue, 27 Jul 2021 13:39:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 08E8161A7F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 67A1A6B0036; Tue, 27 Jul 2021 09:39:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62A0A8D0001; Tue, 27 Jul 2021 09:39:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 518B76B006C; Tue, 27 Jul 2021 09:39:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 39AA26B0036 for ; Tue, 27 Jul 2021 09:39:58 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D54452195B for ; Tue, 27 Jul 2021 13:39:57 +0000 (UTC) X-FDA: 78408476034.19.FDC77A0 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf14.hostedemail.com (Postfix) with ESMTP id 18A7B6007ED1 for ; Tue, 27 Jul 2021 13:39:56 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id k4-20020a17090a5144b02901731c776526so4286895pjm.4 for ; Tue, 27 Jul 2021 06:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0EuAdJ2j3Xy0wD/MXKwZ/PwZTNMmcTB1bfhzXbegpT8=; b=OeyAi2UTKTWbVp/qMcrINmfyO/LiUfMC5mKML0fs/Se/Osx2AXIKqsFoml0FtAfvZU wXu2X/iGWw/iqftzqKLG9r5kHy4YXAJZEwh2FIJw1FPF20pxUpihuExFJS3XkxJKEJg5 cIPdejsvCQ1OI1oR0AAcM8cXthGlaeC+ZHA60kPxdItf4zktXNVg8FwQHl9d45gqr6RW Trva3LvqGr4yfXLnZy+LhWKmQ6OR/Oykg1QMcJk9Ncwy0kc4XZu0BnpUmRnDjaX4m9Gx ONNtIo8lA8GfBiJgpRjloIHldM1SN7Q2JdkUz54XQFS/NT924wl+TzlSOPU4zLtVj6mh Ej2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0EuAdJ2j3Xy0wD/MXKwZ/PwZTNMmcTB1bfhzXbegpT8=; b=Aserie3hXL5P7iIz5N6wWf4UMjv/Rf8jkftP3DpShgOG8zUQywopHNVgQtpO8ebbjv LuqhrYZpC+IW4hJbU1dym2UIlgSd3tXTEM527csG0szO+JpLu32m8g2irXHm3OK5RClc 6vM1F71PGWUvOH1ysLootlAFErINBZbbqKE8d0KFRhilUaVGJl01fPiPOOhhentKenuw OiowD0Fkl45OeS/yPmIksQ6qiPof5qXQnZkKi9LGXiBjaZI5vAwxIKdhtuAKl3kBhXWw HZzSbzDuMV+MG/V98eDEU7gNBFMnl+bSQ0uSNrKlX5Ma3Nm08F+6LkePo5LOdQZr0Gr3 TD7Q== X-Gm-Message-State: AOAM532Y83bl8/nu4vNEszYe//vPqwpnaisJywdb7V/LTzPPMfGter4d nKqP1WRQdXFYCtpxnDizm3IQzVN97cbRc3LB6ILFFQ== X-Google-Smtp-Source: ABdhPJzBfHNbdE8QZCQo1KfFkwCTH8KqVgtlNH0zqRZJ1iKnUGTO5j5NK3RgzPw2/D0tchJpoenEbqHB1cxeOgLzLhQ= X-Received: by 2002:a17:902:6ac9:b029:12c:3bac:8d78 with SMTP id i9-20020a1709026ac9b029012c3bac8d78mr5117123plt.34.1627393195692; Tue, 27 Jul 2021 06:39:55 -0700 (PDT) MIME-Version: 1.0 References: <20210718043034.76431-1-zhengqi.arch@bytedance.com> <20210718043034.76431-4-zhengqi.arch@bytedance.com> In-Reply-To: <20210718043034.76431-4-zhengqi.arch@bytedance.com> From: Muchun Song Date: Tue, 27 Jul 2021 21:39:17 +0800 Message-ID: Subject: Re: [PATCH 3/7] mm: remove redundant smp_wmb() To: Qi Zheng Cc: Andrew Morton , Thomas Gleixner , Johannes Weiner , Michal Hocko , Vladimir Davydov , linux-doc@vger.kernel.org, LKML , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 18A7B6007ED1 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=OeyAi2UT; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf14.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Stat-Signature: crigcchzxc5qza7413a8r1ato3r1b3d1 X-HE-Tag: 1627393196-714036 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 Sun, Jul 18, 2021 at 12:31 PM Qi Zheng wrote: > > The smp_wmb() which is in the __pte_alloc() is used to > ensure all ptes setup is visible before the pte is made > visible to other CPUs by being put into page tables. We > only need this when the pte is actually populated, so > move it to pte_install(). __pte_alloc_kernel(), > __p4d_alloc(), __pud_alloc() and __pmd_alloc() are similar > to this case. > > We can also defer smp_wmb() to the place where the pmd entry > is really populated by preallocated pte. There are two kinds > of user of preallocated pte, one is filemap & finish_fault(), > another is THP. The former does not need another smp_wmb() > because the smp_wmb() has been done by pte_install(). > Fortunately, the latter also does not need another smp_wmb() > because there is already a smp_wmb() before populating the > new pte when the THP use preallocated pte to split huge pmd. s/use/uses a/g s/split huge/split a huge/g > > Signed-off-by: Qi Zheng Reviewed-by: Muchun Song