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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 44006C5519F for ; Wed, 25 Nov 2020 13:24:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 508EA20715 for ; Wed, 25 Nov 2020 13:24:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KLKI3kKH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 508EA20715 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1EC7D6B0070; Wed, 25 Nov 2020 08:24:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 19E3D6B0071; Wed, 25 Nov 2020 08:24:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08D256B0072; Wed, 25 Nov 2020 08:24:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id E30696B0070 for ; Wed, 25 Nov 2020 08:24:38 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A8796180AD817 for ; Wed, 25 Nov 2020 13:24:38 +0000 (UTC) X-FDA: 77523010236.09.eyes17_5a0721927377 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 96EB6180AD815 for ; Wed, 25 Nov 2020 13:24:38 +0000 (UTC) X-HE-Tag: eyes17_5a0721927377 X-Filterd-Recvd-Size: 4229 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 13:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606310677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yfYwxxCydXD+/2AZjU2DkkyQyPi22Qxb5NijBr+uWj0=; b=KLKI3kKHFh8gfqfrDsSYXzSZOugFkyJxAAYJmGWXUOdxwpx9o0+wXoVFAw4abr61iyvZ9f uULaeGbwek+sKJrk1JgEO+GvDsB5oFbke80aha0oJRGtrZII337Wo3XrP8QdZ61dMqAjJD vQmHzruVc/iNSXl07GgaDMWl2G/zx/I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-242-I-oSW_vvNE2vnVfTOlFbYw-1; Wed, 25 Nov 2020 08:24:33 -0500 X-MC-Unique: I-oSW_vvNE2vnVfTOlFbYw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94DC080EDA9; Wed, 25 Nov 2020 13:24:31 +0000 (UTC) Received: from [10.36.112.131] (ovpn-112-131.ams2.redhat.com [10.36.112.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 210F15D6AC; Wed, 25 Nov 2020 13:24:29 +0000 (UTC) Subject: Re: [PATCH 1/2] sparc: Fix handling of page table constructor failure To: Matthew Wilcox Cc: akpm@linux-foundation.org, davem@davemloft.net, rppt@kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20201125034655.27687-1-willy@infradead.org> <20201125121037.GJ4327@casper.infradead.org> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <5b574e0d-107a-3ebc-d631-b59e88de7174@redhat.com> Date: Wed, 25 Nov 2020 14:24:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201125121037.GJ4327@casper.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 25.11.20 13:10, Matthew Wilcox wrote: > On Wed, Nov 25, 2020 at 09:43:15AM +0100, David Hildenbrand wrote: >> On 25.11.20 04:46, Matthew Wilcox (Oracle) wrote: >>> The page has just been allocated, so its refcount is 1. free_unref_page() >>> is for use on pages which have a zero refcount. Use __free_page() >>> like the other implementations of pte_alloc_one(). >>> >>> Fixes: 1ae9ae5f7df7 ("sparc: handle pgtable_page_ctor() fail") >>> Signed-off-by: Matthew Wilcox (Oracle) >>> --- >>> arch/sparc/mm/init_64.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c >>> index 96edf64d4fb3..182bb7bdaa0a 100644 >>> --- a/arch/sparc/mm/init_64.c >>> +++ b/arch/sparc/mm/init_64.c >>> @@ -2894,7 +2894,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm) >>> if (!page) >>> return NULL; >>> if (!pgtable_pte_page_ctor(page)) { >>> - free_unref_page(page); >>> + __free_page(page); >>> return NULL; >>> } >>> return (pte_t *) page_address(page); >>> >> >> I wonder if reusing __pte_alloc_one() - e.g., internally - would be even >> cleaner. > > It's really awkward to do because pgtable_t is defined differently. > The clean thing to do would be: > > --- arch/sparc/include/asm/page_64.h > -typedef pte_t *pgtable_t; > +typedef struct page *pgtable_t; > > and then do all the other changes that would require. > > But that feels like a lot more work than appropriate to fix this > unlikely bug. Yeah, cleanups would have to come on top of the fix of course. But I can understand that you have plenty of better things to do :) ... maybe sparc people want to work on that at one point. -- Thanks, David / dhildenb