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 16C0CC433F5 for ; Mon, 9 May 2022 04:06:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 492966B0071; Mon, 9 May 2022 00:06:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4423F6B0073; Mon, 9 May 2022 00:06:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E3DF6B0074; Mon, 9 May 2022 00:06:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1CE796B0071 for ; Mon, 9 May 2022 00:06:51 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CC53ABA8 for ; Mon, 9 May 2022 04:06:50 +0000 (UTC) X-FDA: 79444868580.03.B174FB4 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf23.hostedemail.com (Postfix) with ESMTP id 74EFE140070 for ; Mon, 9 May 2022 04:06:37 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id x18so12708537plg.6 for ; Sun, 08 May 2022 21:06:49 -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=i8fTOca+12ZBwL8GFn68r89tRt5Zov30Zcvy0gFIx3s=; b=7oatG6weF86vW9pYog/WbnQv4ca5m77rm6XTxoXr1wXD+MeQ64n02aa13Lj0IMGWDh 0jcAZ1/E8rhHmjwEiLH/wurqHwo7x7/oZPYnCacuSWGecYOh1cK7FR/f3ATgGUHe2XoH alZRF5CLU74LfUYGYSIuPW6xCoE9yhYrt5aPGmZHPMFjbnAa5HGvTb+BGlG1lzOEp7hA 36hA/3+gDs89H4Ko4WXpK9eOIJ7FvaCtE+d5TzIwgk5OffyCSOeBgBkeqs8WGQvukk6n Rziui08UqLz3/L11wKnIDNIsOSawBpoleO3JIuQk/5rZjNynFDwVMrI47wZqmUxCKfmZ bBpw== 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=i8fTOca+12ZBwL8GFn68r89tRt5Zov30Zcvy0gFIx3s=; b=MOGPzHR2rDSUMcIY7u8cH2CfMey2/fXVNjLsvrs3uD4yUeqIuIdxxjJpN+Ul+WVt09 qaNtGrdfMnzQe/JEOlFQFVtxIaPPrhbPASNscCp3B+1WwDu066NgvNXSixyaXg3YI/cP u/qCzKCbb6atB66xVkY85CKUWC6W9LjPg0vkZuTi/PLspxKBdpY6JIIL650LoxPo58l/ D2/D0sfSFN9uPAQSrt7Nc3ED6zvzg10ZpYGXHYy7VNgf57AKmgybisrkj56QsSqd2AjD PAcb5UFq5SsmUG7ppTlJW51xfPJ2T8799DieSFjl9+SYEeR4dBVhIwnVjy53DEvYcOk1 3kTw== X-Gm-Message-State: AOAM533zcA7GAhPgCRicG01Ta0faBZUhHB2uoLTZyIWhq0QoMsG2ubUA jGdWyt4Wls9kBwuj29dV3zM7Lw== X-Google-Smtp-Source: ABdhPJzXNNNMoKGLlNS0rEzt5xQj0NLF+6rNIW0g3Nng1UFaP6z9LjY7xwl48st6GzktvUM1QgACdw== X-Received: by 2002:a17:902:758a:b0:15e:ef4f:fed5 with SMTP id j10-20020a170902758a00b0015eef4ffed5mr12919922pll.1.1652069208384; Sun, 08 May 2022 21:06:48 -0700 (PDT) Received: from localhost ([139.177.225.250]) by smtp.gmail.com with ESMTPSA id f4-20020a170902ab8400b0015e8d4eb1f8sm5831321plr.66.2022.05.08.21.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:06:47 -0700 (PDT) Date: Mon, 9 May 2022 12:06:43 +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: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 74EFE140070 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=7oatG6we; spf=pass (imf23.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-Stat-Signature: m1cbsj5noqqsqomk35bbaj4qmmibmyie X-HE-Tag: 1652069197-659079 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, May 08, 2022 at 09:09:55PM +0800, Baolin Wang wrote: > > > On 5/8/2022 7:09 PM, Muchun Song wrote: > > 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 > > Thanks for reviewing. > > > > > 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? > > I did not meet any warning without the casting, but this is per Mike's > comment[1] to make the code consistent with other functions casting to void > type explicitly in hugetlb.c file. > Got it. I see hugetlb.c per this rule, while others do not. > [1] > https://lore.kernel.org/all/495c4ebe-a5b4-afb6-4cb0-956c1b18d0cc@oracle.com/ >