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 D4A9AC433EF for ; Mon, 20 Jun 2022 04:48:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60CFC8E0001; Mon, 20 Jun 2022 00:48:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56F8B6B0074; Mon, 20 Jun 2022 00:48:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4108C8E0001; Mon, 20 Jun 2022 00:48:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2E76D6B0073 for ; Mon, 20 Jun 2022 00:48:57 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EAEE033A05 for ; Mon, 20 Jun 2022 04:48:56 +0000 (UTC) X-FDA: 79597384272.28.0CC65CA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id 93DAA140019 for ; Mon, 20 Jun 2022 04:48:56 +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=OWtEjGnDXMqHCzyuteqvu4muriObYgLh/nz12B7kppM=; b=YBu3qKIxX5PkuZIFEAPlrHgEZw knTtNcBQKD4aHmdqF8POgZRwKprTVVenaZfaQxqTEydkvJw99i/dj0yFgcdQ/rNsJnlM+lYEFdXj1 J+RkSjehV9mFk6Tsq00Um+wRNMA/1ta8ysMftb5X5YpkuzspyPfMtGI9uv+wJN+ANIUXz4hluU+We Vw/Mzx77HLW1s17VO8GC0FNpXPOeefBtonY5wNgcCOtkVuAd1KRp7vf7I4uKlJ6EYX5pporKQUiDP HkfKlYSMYngq8y+SMPpJtlZb6t76vejXtiUxliVt1pgTR4jk5YhXOSrFS7u4peFi24HHy7E4owBBE 251EkkfQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1o39LK-004s34-P6; Mon, 20 Jun 2022 04:48:54 +0000 Date: Mon, 20 Jun 2022 05:48:54 +0100 From: Matthew Wilcox To: Miaohe Lin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: stricter check on THP migration entry Message-ID: References: <20220618073243.9423-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220618073243.9423-1-linmiaohe@huawei.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655700536; 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=OWtEjGnDXMqHCzyuteqvu4muriObYgLh/nz12B7kppM=; b=mZTBLFDHu/VAiBUVnAB78mFonqQmf6MXR2MCxZ4KsySKDff1J2+HX85GbyqdTSTQ4qDFaA 25jtxoF6iuMjpdfqzUzd9fvxclNbu+zcH9q5v+eQRZ57Y8ixtEFpq4GwiS3SvCYF0NKT+H 28I/GmqZkpTJDoneVS2JR+ohKzDvuEA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655700536; a=rsa-sha256; cv=none; b=0v80oRidxKq77mhr1yaO9zpGQyvTl/z+Q9i2sJtoUCH+Ws7aKm6CDZR6SCcXnbrUQa9Fx9 JaiR1LNJPFvAwJMz8yFjcfogY7TjH4T27yLI8d+cPq27c9DGuWjjxXP0Q9ue6V0uFuKMV9 NuYXfdBWhnQg1pSomVaHrQUeVPHgfhU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YBu3qKIx; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YBu3qKIx; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: r8uruj4butuz6p3hiauuhoo6org9itta X-Rspamd-Queue-Id: 93DAA140019 X-HE-Tag: 1655700536-543534 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 Sat, Jun 18, 2022 at 03:32:43PM +0800, Miaohe Lin wrote: > When VM_BUG_ON check for THP migration entry, the existing code only check > thp_migration_supported case, but not for !thp_migration_supported case. > If !thp_migration_supported() and !pmd_present(), the original code may > dead loop in theory. To make the VM_BUG_ON check more consistent, we need > to catch both cases. This patch makes no sense to me. > Signed-off-by: Miaohe Lin > --- > mm/memory.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index fee2884481f2..6a9a17c7f58a 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -5043,10 +5043,9 @@ static vm_fault_t __handle_mm_fault(struct vm_area_struct *vma, > > barrier(); > if (unlikely(is_swap_pmd(vmf.orig_pmd))) { > - VM_BUG_ON(thp_migration_supported() && > - !is_pmd_migration_entry(vmf.orig_pmd)); > - if (is_pmd_migration_entry(vmf.orig_pmd)) > - pmd_migration_entry_wait(mm, vmf.pmd); > + VM_BUG_ON(!thp_migration_supported() || > + !is_pmd_migration_entry(vmf.orig_pmd)); > + pmd_migration_entry_wait(mm, vmf.pmd); > return 0; > } > if (pmd_trans_huge(vmf.orig_pmd) || pmd_devmap(vmf.orig_pmd)) { > -- > 2.23.0 > >