Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp628869pxk; Wed, 2 Sep 2020 10:29:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlskF0MYgh7CKBc85D75QsVpAccL4rrRfX7JpOt0FBL6PlTNIuMwHgcZ2vJfqpLzpZDFjs X-Received: by 2002:a17:906:69d5:: with SMTP id g21mr985946ejs.461.1599067743113; Wed, 02 Sep 2020 10:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599067743; cv=none; d=google.com; s=arc-20160816; b=kff3+DRCBmN0hht6PKfo7TgMUxKg76eT7XfKz8oeHR7KIxibX5IBU/EtuNE+SFwXog crQclT5JdjkzDKlvlMdYyiyPYhpYreq5+z8e11KnFcIqjgYmsBQGPvCl6ryJnl7V4uva bcruQALBot9fQh0SjWsBSyALB5i5QvwoMWoNrB3TQ9fXqUpU6lJ0kElLkrrCgsKYX/b2 qeTYYNN8KFObTKRBuU5n0Kx+RsfB7B2+ULxN36FBFTqTmxXiLyR9XmR9xblckSsy90t6 Y0fWa3emzQB1ZmJrAtT4rmJKTOqz71kUc4kSKk7jwsPosygSzNoPtdP2+0iNuhegwgOy BtoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5be8iFJXOcgcgdFZzn/kuNfFoTvUiJear07v/iHmf8Y=; b=BWx1EXfWq5gwmuNmOjNr7c8PiKWbxGhcoJ37GkRzpLyx2xGMX+g7Ldag9QVakkX6Hi YogOKcdtfx/7sStPY2VKJDvBr+UzJjMW5d32xmk6Y8u8m+P7FLds+x3zn4Jax9wslIeB CK7GjVnKbEoYTh1Jaj9TbyiuQLgrcLITGD2VxF4T11SufFSM3KSO0ppGLWbnJkloV9VY +LWNKVtgr+7AVVX6fmebSdzQFemJkIbTqt8dA/ZwA3J4l2PWxaVh1oU+BXOSN+WJ/5xk HsJe8Z+A2oPonrakYLz3G+I6QpaJJIgFCWfvapwnl4EZb4XlKEGSKypF0pZVa9BY6iPL h/RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="eKS/uT96"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si162585ejc.17.2020.09.02.10.28.39; Wed, 02 Sep 2020 10:29:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="eKS/uT96"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbgIBR0E (ORCPT + 99 others); Wed, 2 Sep 2020 13:26:04 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46330 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbgIBR0D (ORCPT ); Wed, 2 Sep 2020 13:26:03 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 082HOu3j086686; Wed, 2 Sep 2020 17:25:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=5be8iFJXOcgcgdFZzn/kuNfFoTvUiJear07v/iHmf8Y=; b=eKS/uT96dz8tO+/BHDz346JQjUJh8G3u8GhMtCj6zEflcIKH9R71c6Fi0l++3sxe73E7 WgjMsuciWeljsc6Kn4czu21+C4aD+K5DdIIt5BtrozXTVUCOOVfCwXKmci8eB1VSxAlR PZDhrv7pu5gIMTqZMqjlSox7QWPRR9gSlmLFfkrF/cVGbmWLhwiQr+QuKnQ3yrMJmH38 F3qvHtetXkt6iaAV+MM4dW5Cg3ruXurq6NoCYD47kUdOzCqRfSn6rCTYJTDtln3RtZjT zI3N//crkiX8yY6trQFpnDGif1qFRSCOI3o08kel3r9TIGoC9Dk3uATM9dCobAsjdN0c Gw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 337eer43sm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 02 Sep 2020 17:25:51 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 082HPlwD089347; Wed, 2 Sep 2020 17:25:51 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 3380y03r2p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Sep 2020 17:25:50 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 082HPnxr000972; Wed, 2 Sep 2020 17:25:49 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 Sep 2020 10:25:49 -0700 Subject: Re: [Patch v4 5/7] mm/hugetlb: a page from buddy is not on any list To: Vlastimil Babka , Wei Yang , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, bhe@redhat.com References: <20200901014636.29737-1-richard.weiyang@linux.alibaba.com> <20200901014636.29737-6-richard.weiyang@linux.alibaba.com> From: Mike Kravetz Message-ID: <6e9aebdf-a7a9-fb60-eadf-02088602cfdd@oracle.com> Date: Wed, 2 Sep 2020 10:25:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9732 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=2 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009020165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9732 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 suspectscore=2 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009020165 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/2/20 3:49 AM, Vlastimil Babka wrote: > On 9/1/20 3:46 AM, Wei Yang wrote: >> The page allocated from buddy is not on any list, so just use list_add() >> is enough. >> >> Signed-off-by: Wei Yang >> Reviewed-by: Baoquan He >> Reviewed-by: Mike Kravetz >> --- >> mm/hugetlb.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >> index 441b7f7c623e..c9b292e664c4 100644 >> --- a/mm/hugetlb.c >> +++ b/mm/hugetlb.c >> @@ -2405,7 +2405,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, >> h->resv_huge_pages--; >> } >> spin_lock(&hugetlb_lock); >> - list_move(&page->lru, &h->hugepage_activelist); >> + list_add(&page->lru, &h->hugepage_activelist); > > Hmm, how does that list_move() actually not crash today? > Page has been taken from free lists, thus there was list_del() and page->lru > should be poisoned. > list_move() does __list_del_entry() which will either detect the poison with > CONFIG_DEBUG_LIST, or crash accessing the poison, no? > Am I missing something or does it mean this code is actually never executed in wild? > There is not enough context in the diff, but the hugetlb page was not taken from the free list. Rather, it was just created by a call to alloc_buddy_huge_page_with_mpol(). As part of the allocation/creation prep_new_huge_page will be called which will INIT_LIST_HEAD(&page->lru). -- Mike Kravetz