Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8635274ybn; Tue, 1 Oct 2019 10:55:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqydT4iPMDhaRY3IOjFDlnT+MCRCwshvsYGPtbTOLsLY5y4tHojB4RcVJ2Gul7Pgg/Ro2l+6 X-Received: by 2002:a50:eb41:: with SMTP id z1mr26889495edp.261.1569952547083; Tue, 01 Oct 2019 10:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569952547; cv=none; d=google.com; s=arc-20160816; b=yn3KnkFDHmmLg+cCHxrzo5XFYbxtNkMKSI25oaewWn1oQ9xfu0NII6Apuz4DjhCPWg tG63eBILTAUJdlYCitflaljUz61C7MoDoU3YcA8ydUChHmwzfKAWFGVLVwD57U9Io1hh CNGZKwOJVYKArRfEVyy1b2pw7nsclZg9XwUWrLGEcArJ/9nI5/05YVu9u8cn4MKCzUOM dsNVtaMA4kDOz5a0ccEoRO1mnOVI51fjJLqHtzvaRj6MXO0OZsJxXSSwL+3JYXEY+9i4 tSxoDZhmf5AXw0mli8Mv+Gei2KHP5zQKBNG+PiNfimk90Yen3QyxRc7wNevWNj3arlRA IRig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=BaVcfmO77CbSRF4xJ7ENR7iiC1TjdAOn8cbtscDfEog=; b=LlJwxSiy4ibQBYOBGYd1vwDXUYBxysPR4ckDcU4Loi5n/ahGPS+ShosVxf48P4EuOs KlaxSnz+0b+4AiiC+gqur5QUVPohl6mkqxZfwpB1LpYONVH6olMxNKcX1/ejcIVwI5A8 qhMCfVibp9kAUT5PP/dU3lhZev7iYwola7c+pdyoute67+BqZi+/FTKOgUyBKgV0otkg TQ1DMsmPNPfBBm7YiF6R07oLs2og7Os/oUNUepCQBcUQA8/SrDEHwbbfYqZ61cobUbi7 D3UI5zbTmYD7lnq3MVL0X+lBsQM95dWls3VgcprHxRttmk4wG5uKdDe9sgjoenOLa+mb 063A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=hk7GVMY2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13si9415702ejb.98.2019.10.01.10.55.21; Tue, 01 Oct 2019 10:55:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=hk7GVMY2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730537AbfJARyc (ORCPT + 99 others); Tue, 1 Oct 2019 13:54:32 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:14255 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728486AbfJARyc (ORCPT ); Tue, 1 Oct 2019 13:54:32 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 01 Oct 2019 10:54:39 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 01 Oct 2019 10:54:31 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 01 Oct 2019 10:54:31 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 1 Oct 2019 17:54:30 +0000 Received: from rcampbell-dev.nvidia.com (172.20.13.39) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 1 Oct 2019 17:54:30 +0000 Subject: Re: [PATCH] mm/thp: make set_huge_zero_page() return void To: "Kirill A. Shutemov" CC: , , "Kirill A . Shutemov" , Andrew Morton References: <20190930195528.32553-1-rcampbell@nvidia.com> <20191001115239.dqodyji3r32zjkea@box> From: Ralph Campbell X-Nvconfidentiality: public Message-ID: <68b384ac-b311-6ea2-81ad-053ff7f3ba64@nvidia.com> Date: Tue, 1 Oct 2019 10:54:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20191001115239.dqodyji3r32zjkea@box> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1569952479; bh=BaVcfmO77CbSRF4xJ7ENR7iiC1TjdAOn8cbtscDfEog=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=hk7GVMY2RbARRj+8vRGwRTIBWLlV+9xU34GGzQ5cW09C2Qa5u557QOWPQQhETeelM VLy3eVJ4QwizyOgL08VCQECqRTuxumtTzbHwnYp+af7ROVQBkzB6baK7wctS5Tg+cD u/hPye4SjWz3+DyCUontM8dUS7BGYa/z8mNhUAUtT+SCmljMjehqG3I7S5p2GyiQP2 wHZIbWckPspTZIbV7IavKO4Menqj+M36VOOihk8uryvkLu9nhO7uoQj3sXpnL1HyMu 059FiPMNyImJ0gNZQs35B0icbqnXkltg3n0W4TJRMdfJtZaubpO8Qqdr6gyUVRLAoa i/FCypcgiro2g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/19 4:52 AM, Kirill A. Shutemov wrote: > On Mon, Sep 30, 2019 at 12:55:28PM -0700, Ralph Campbell wrote: >> The return value from set_huge_zero_page() is never checked so simplify >> the code by making it return void. >> >> Signed-off-by: Ralph Campbell >> --- >> mm/huge_memory.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index c5cb6dcd6c69..6cf0ee65538d 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -686,20 +686,18 @@ static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma) >> } >> >> /* Caller must hold page table lock. */ >> -static bool set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm, >> +static void set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm, >> struct vm_area_struct *vma, unsigned long haddr, pmd_t *pmd, >> struct page *zero_page) >> { >> pmd_t entry; >> - if (!pmd_none(*pmd)) >> - return false; >> + > > Wat? So you just bindly overwrite whatever is there? > > NAK. No, the only two places it is called from are do_huge_pmd_anonymous_page() which has the pmd_lock() and already checked pmd_none() is true and copy_huge_pmd() where the destination page table is being filled in with no other threads accessing it. I guess I should have put this analysis in the changelog. Still, I guess putting a pmd_none() check in copy_huge_pmd() as future proofing new callers of copy_huge_pmd() would make sense. >> entry = mk_pmd(zero_page, vma->vm_page_prot); >> entry = pmd_mkhuge(entry); >> if (pgtable) >> pgtable_trans_huge_deposit(mm, pmd, pgtable); >> set_pmd_at(mm, haddr, pmd, entry); >> mm_inc_nr_ptes(mm); >> - return true; >> } >> >> vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) >> -- >> 2.20.1 >> >> >