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 706A6C433EF for ; Fri, 15 Jul 2022 17:50:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBF6794020C; Fri, 15 Jul 2022 13:50:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6F539401FB; Fri, 15 Jul 2022 13:50:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5E0494020C; Fri, 15 Jul 2022 13:50:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B6BBD9401FB for ; Fri, 15 Jul 2022 13:50:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7B70A15C4 for ; Fri, 15 Jul 2022 17:50:50 +0000 (UTC) X-FDA: 79690074660.10.C38B520 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id BA5AE180036 for ; Fri, 15 Jul 2022 17:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jTcOrPA+ocFbinFbt5VpQCoXRpjbOrc2oieHhF7HDbU=; b=B1PHL2D/OoKCq1vGITDu2dnvgR lSeZv2qJY8qSk3+YDMMci0r+pa2+qIhvYmF2748kPNIl0IwOtrvI5zSCeVML+rpNOojkFMpYfba/Q X8floWxTJloOg7zhAIt2yegLLvTI0L9GTJIAPWBqi38WNgUyhyMGgJOjzotJQukTVcud8tZmGpye3 SwMdNc9D8zy9YwXSnmYIk0UWELw+eszyyPHo7kvdYtz44g8b8AofzhI/+vUhkDA6YZzKX63y5/599 c4dpC0SQVA/rU6ynqsCQmer5e+LFDDHf2WGxeWyyuJUj5rZk0VB8vlvhC8MxRHLkmTIyx36Z1dOoc UOGd6o5A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCPSW-00ARIe-AS; Fri, 15 Jul 2022 17:50:36 +0000 Date: Fri, 15 Jul 2022 18:50:36 +0100 From: Matthew Wilcox To: Zhou Guanghui Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm/huge_memory: Return from zap_huge_pmd after WARN_ONCE. Message-ID: References: <20220715092238.22663-1-zhouguanghui1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220715092238.22663-1-zhouguanghui1@huawei.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657907449; a=rsa-sha256; cv=none; b=ZDJhVrcS1DBPWFzAqTlZMstvzDVN0nVyQN9tZl93/YGlDOhY1gTQtB8n4szfGHvBzYEuJX ce5L845MC65ke29KnKYtriLPVaAE+r/sePLeX/auDnLxLFwHEUIxiT2IRz9CRsdGhwL8Oq yfBdsiPeElXUSHzRTWPqL2Rp9r0/crw= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="B1PHL2D/"; dmarc=none; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657907449; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jTcOrPA+ocFbinFbt5VpQCoXRpjbOrc2oieHhF7HDbU=; b=vl0yAF/Lf9StxVIf/3I5AUbUxjbjy/8zFRecLe1Sf1c3KLKkcedL6ITbYUr7He+kvevhg5 7YbcHia7so8gyicRO0yaC7ZvPVTcV8LzCh6oEBawOsYTCVXjVraeGOs5yuppeXyTIRVE5x Aa6w7/eMFNiteIoydZCoxFmOp6BQCZ0= X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="B1PHL2D/"; dmarc=none; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: wbg7xy4udswapmo48eacjo586t3n7r6n X-Rspamd-Queue-Id: BA5AE180036 X-Rspamd-Server: rspam08 X-HE-Tag: 1657907449-216909 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 Fri, Jul 15, 2022 at 09:22:38AM +0000, Zhou Guanghui wrote: > After WARN_ONCE is processed, the subsequent page judgment results > in NULL pointer access. It is more reasonable to return from the > function here. I'm not sure this is a good idea. Probably better to crash than continue. > Signed-off-by: Zhou Guanghui > --- > mm/huge_memory.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 834f288b3769..7f5ccca6792a 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1601,8 +1601,11 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, > entry = pmd_to_swp_entry(orig_pmd); > page = pfn_swap_entry_to_page(entry); > flush_needed = 0; > - } else > + } else { > + spin_unlock(ptl); > WARN_ONCE(1, "Non present huge pmd without pmd migration enabled!"); > + return 1; > + } > > if (PageAnon(page)) { > zap_deposited_table(tlb->mm, pmd); > -- > 2.17.1 > >