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.8 required=3.0 tests=BAYES_00, 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 8FAB6C433E7 for ; Wed, 2 Sep 2020 17:56:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5EDAC2083B for ; Wed, 2 Sep 2020 17:56:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EDAC2083B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C9DCB900011; Wed, 2 Sep 2020 13:56:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C4D3190000F; Wed, 2 Sep 2020 13:56:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8A28900011; Wed, 2 Sep 2020 13:56:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id A3FFF90000F for ; Wed, 2 Sep 2020 13:56:24 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6B42E181AEF10 for ; Wed, 2 Sep 2020 17:56:24 +0000 (UTC) X-FDA: 77218875888.12.coat87_131119b270a2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 3124418006FDF for ; Wed, 2 Sep 2020 17:56:24 +0000 (UTC) X-HE-Tag: coat87_131119b270a2 X-Filterd-Recvd-Size: 3037 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Sep 2020 17:56:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A4685AD5C; Wed, 2 Sep 2020 17:56:23 +0000 (UTC) Subject: Re: [Patch v4 5/7] mm/hugetlb: a page from buddy is not on any list To: Mike Kravetz , 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> <6e9aebdf-a7a9-fb60-eadf-02088602cfdd@oracle.com> From: Vlastimil Babka Message-ID: Date: Wed, 2 Sep 2020 19:56:22 +0200 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: <6e9aebdf-a7a9-fb60-eadf-02088602cfdd@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3124418006FDF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 7:25 PM, Mike Kravetz wrote: > 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). Ah so indeed I was missing something :) Thanks. Then this is indeed a an optimization and not a bugfix and doesn't need stable@. Sorry for the noise.