Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp645708pxk; Wed, 2 Sep 2020 10:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2/p2aUwkKvVwAHF4hhLIFl1LAGhcZ/lQww9TtxHaJbn/A/TMVBDqjY6lUr5h2ZhvWJvwz X-Received: by 2002:aa7:dc05:: with SMTP id b5mr1273919edu.137.1599069540673; Wed, 02 Sep 2020 10:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599069540; cv=none; d=google.com; s=arc-20160816; b=yWuqI2ZfZXi89j4UketWSHLWq8qUSocNFQnsatxC8ij9Hvu/1iN1sXvpRr/ULZdDk9 u5kZIySzUzmJPkDpD17lJF1TnhbR3bvtmFdxn4OQFV5U7M7qluQgSUV/zhfYkL3KF1xo a8vkr8E8WvY3BbEc0wKSW88PPxO7PvypKJKCuoKn2zI94QLgBN9seoZgNpA+i4Ehzj+Q 6zXqCtlC+VhQF/bK0KvHXZMQPSkyD5CXPjmICVMR2cwOeK+kfWfOOYyfrwohKUpc+4RM 0kDrnR2yWD8wQ6zxSGXB9mSHO9WcLwJSwe14P6xffcfnK8vTEqAF/xCB0Aql48306vXL Mh+Q== 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; bh=N1YPvRf6UQ35Nxf9gwkXvWiFGJTJBDEkja7NmXLlBiU=; b=RZnY6iPmG/L2wPI1SW+F21sUzyu8ngBo8Tmg9m162t2jrz7cPrpDDocaOCriNLeTze 8a3CcI7M85FVwIDhNC43PV+mr3Xhjn61Ck/aev5jmZaIK2BShygn5+yBOyFFdOZHJ7Zw xhYJqfE6tpH1drbvGYeEWTK1tUNJJp94MitTOG8k7x5Fix50s5rOd6m8W+C2VYxD5jXd GV4mHgCn7WNop0h/7rY1iEbotmq3P3qmfkpRG7l+0g+/z6ikQcKXFd2NcCEHLvGCIVgl irHk/uD/Sgi7ab0Azp/rMhfPfR5g1gCGE8RK09NYsD813BuVJQz3e6SFpTNgCyCCZJu3 TTSA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si137834eje.588.2020.09.02.10.58.36; Wed, 02 Sep 2020 10:59:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727864AbgIBR4X (ORCPT + 99 others); Wed, 2 Sep 2020 13:56:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:47338 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgIBR4X (ORCPT ); Wed, 2 Sep 2020 13:56:23 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.