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=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,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 BBCC6C433E2 for ; Wed, 2 Sep 2020 17:25:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6FFF720684 for ; Wed, 2 Sep 2020 17:25:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="eKS/uT96" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FFF720684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 090A86B0099; Wed, 2 Sep 2020 13:25:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 040CD90000C; Wed, 2 Sep 2020 13:25:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E721E6B009B; Wed, 2 Sep 2020 13:25:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id CE44B6B0099 for ; Wed, 2 Sep 2020 13:25:53 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 83F2B8248D51 for ; Wed, 2 Sep 2020 17:25:53 +0000 (UTC) X-FDA: 77218798986.04.sign23_020da0f270a2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 511E88005A86 for ; Wed, 2 Sep 2020 17:25:53 +0000 (UTC) X-HE-Tag: sign23_020da0f270a2 X-Filterd-Recvd-Size: 5177 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Sep 2020 17:25:52 +0000 (UTC) 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 X-Rspamd-Queue-Id: 511E88005A86 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 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