Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4893899iob; Mon, 9 May 2022 04:16:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQGI22upComAmd4qDc1gCGhvc0dNivp46XKPud7DWKInvUxh9m8erWtv+owf1rlCXm0c7X X-Received: by 2002:a17:902:f789:b0:156:5f56:ddff with SMTP id q9-20020a170902f78900b001565f56ddffmr16059956pln.116.1652095010921; Mon, 09 May 2022 04:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652095010; cv=none; d=google.com; s=arc-20160816; b=G18KVLYFwRj6tuxv+PAv+IGxWUDlDoGmfFqqVkh7of9GgZnqaVzF0ExrmrkKQnal6y C6z1T8AWXdPFiWqJIPPFgOKuqPdi9G7VNG53+m0dBJpVhi3Sf2VppR5xuCmOcc8qASls 0KDlGaNRsDdyU6UBJZive+HKbv8wfNCF5Luw+s0D1DHuXojopAt2+RKY7WvbAoZ1bKeT pFwyCLnQsoYg8LC/0+5875QM7EDWvlanrkeI/rfJnhWRSyoKaVvtzDGAPZhpXhwrOssc FpRDohUdbLrEQfMFE5tOJ54RNX45kNXbVOxMHEwmCRNNxyK0sZvo8LAM6BzQlFB3C33D bK6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OWmWFuKURN4UwCDRPsgR9Re+rOOqJePNgFLKfmRbPyI=; b=0KfEi7n+tQOLI1ht8Mwc9sSmGwQc7fIRhDpTaWRbn3DKrKIaYj5E9E9n8L7TYxWSMr 2X2PRn8Eh050SvbZZWVO1MVL8AnHD5/x9CWUjd+QtdAYpwlH7rQ0BeMfEovO5P8Dtr97 m4alAU4URYyZXc8e5vPJ0XkNpmX/XyYMSx6DO8aHd/exgTNiWtC89n44WZm9U2GppuJp Tf2hPnb8Oj5ecAaevGcPiKinTrEWBnZJ8iYQhwQJiwZ5F6qcbD3AvDADVZEC0of+7L9L DTN6Q+B3DyBQ8htOt6Mywk+6uG49ZCY7dNlct348oCanEvoGp+fDPjqOQk/dVtrEpyWR 9QLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=UlTfZYFJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b17-20020a056a000a9100b004fac74c8c8asi15597637pfl.329.2022.05.09.04.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:16:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=UlTfZYFJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78F212317C4; Mon, 9 May 2022 03:26:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232034AbiEHLNp (ORCPT + 99 others); Sun, 8 May 2022 07:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232035AbiEHLNj (ORCPT ); Sun, 8 May 2022 07:13:39 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3E4DDF90 for ; Sun, 8 May 2022 04:09:48 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id p12so9994057pfn.0 for ; Sun, 08 May 2022 04:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OWmWFuKURN4UwCDRPsgR9Re+rOOqJePNgFLKfmRbPyI=; b=UlTfZYFJ8cQvbSFvJYR0MNjIVNnz94wcIJy7bmyHAq3K7dhExqiXwQ6GlaTqAWyxzy /Z/UihrYn4PiXbZkL0LHCX2s5FoaTSEdl9xmTkNYPq7h9HiO+occ9eYuqUW2zt7FKqmt b3PN1o5ZoZJqlKw9pM5JrZNOlSwE6WvfVuInjWEAmfTWiOCutIUTw8vwaC1o1YFjwp9f +xjwh/8BPP6aVzOrMhkxbxgpxLomJCpFhrQhBvrcVb/DbwLhuEyhNqWHYVVFWiB/5sZZ 2U9B/tv5Pzx5HC7lG5vZPP5nVcDqOI8s7xA4xdRGTcVQxNcgXyFbsuZyVPlp5azgbVRy VmuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OWmWFuKURN4UwCDRPsgR9Re+rOOqJePNgFLKfmRbPyI=; b=wQtAmBrabacdeIczpPFBmfgN+HCXHSYKoWhiP3ftBajEnuoZ5NL+wgPBSuJR8vcNQU gzQHK/OuENTurMEb7gPOTwrfVKVdhk2Wo/QjsqeFCrbgG09CIZo000QEoKATHZKb1jTB /WZPenInuHZ5DRTfZ5llmU0Py6KYuNkSxhhuQCTOYZOqgCab+pF6QrsrnJ/Rrlf4pyRL U06dzC0DiDqjkmOPPgjsahGC3+Vr0sxqKwkXcWt+LTQG5I0AdbaxEV5pK9B3GWlao7el B2WEvTcJUBtiYOEGqwUqvioymnEpJgwlMrrD+d6HeWaScOvP7YP8rMeJb/e8cQVfy0sT CJRg== X-Gm-Message-State: AOAM531G2AueE0NRKTeLAlXki2j7i3ZcOsk1uMr/cW9CkbN81Um/bijz pNmQm5XXswzyZTEMTXI/o814MA== X-Received: by 2002:a62:b60f:0:b0:508:2a61:2c8b with SMTP id j15-20020a62b60f000000b005082a612c8bmr11424511pff.2.1652008187667; Sun, 08 May 2022 04:09:47 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id 17-20020a170902e9d100b0015ea8b4b8f3sm4943158plk.263.2022.05.08.04.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 04:09:47 -0700 (PDT) Date: Sun, 8 May 2022 19:09:45 +0800 From: Muchun Song To: Baolin Wang Cc: akpm@linux-foundation.org, mike.kravetz@oracle.com, catalin.marinas@arm.com, will@kernel.org, tsbogend@alpha.franken.de, James.Bottomley@HansenPartnership.com, deller@gmx.de, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 1/3] mm: change huge_ptep_clear_flush() to return the original pte Message-ID: References: <012a484019e7ad77c39deab0af52a6755d8438c8.1652002221.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <012a484019e7ad77c39deab0af52a6755d8438c8.1652002221.git.baolin.wang@linux.alibaba.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 08, 2022 at 05:36:39PM +0800, Baolin Wang wrote: > It is incorrect to use ptep_clear_flush() to nuke a hugetlb page > table when unmapping or migrating a hugetlb page, and will change > to use huge_ptep_clear_flush() instead in the following patches. > > So this is a preparation patch, which changes the huge_ptep_clear_flush() > to return the original pte to help to nuke a hugetlb page table. > > Signed-off-by: Baolin Wang > Acked-by: Mike Kravetz Reviewed-by: Muchun Song But one nit below: [...] > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 8605d7e..61a21af 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -5342,7 +5342,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, > ClearHPageRestoreReserve(new_page); > > /* Break COW or unshare */ > - huge_ptep_clear_flush(vma, haddr, ptep); > + (void)huge_ptep_clear_flush(vma, haddr, ptep); Why add a "(void)" here? Is there any warning if no "(void)"? IIUC, I think we can remove this, right? > mmu_notifier_invalidate_range(mm, range.start, range.end); > page_remove_rmap(old_page, vma, true); > hugepage_add_new_anon_rmap(new_page, vma, haddr); > -- > 1.8.3.1 > >