Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp370615pxk; Wed, 2 Sep 2020 03:53:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGfEESPsh0rEB6c/ACABYDFcovdoT9WWVcJtg+zi6TN+xkBpsII2NrEMfB5URUNd6Ni2yv X-Received: by 2002:aa7:c70a:: with SMTP id i10mr6003896edq.218.1599044005992; Wed, 02 Sep 2020 03:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599044005; cv=none; d=google.com; s=arc-20160816; b=s3PC9IX1X8rqT2KNL9A+COphBdeIHy/xN1vy/brJBvxBUKWBWL8WkcYfYuUfhK90C8 dtD57LDXopE83kxQdQb6shtXTSCWlLgGjaY7NQo0/l+yzXmLT1+NxFAT1F6JsAhaBaBS dVvnUMBn61IzrxUehYZW8u6IRedWJrGLgkBDm/KFDDOJ1k9PyDc5fUv7LWA4W+b732dj nTwGoV+KNpD7jZ9YpkZft2nHCcVWeie/ga03yu9oOpo06HcXtp/+041JMOpzE6Sx57Bt S4ItSbULRQGMK70oPO/eMYRiTfXcva18ARJJrscD2T+JNnfpBOS9roo+7ZxL8Rdop38m VEzg== 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=YoVwwL6ySQnjRV47CtfrZ8/oYUW7isyWYCIPDAcmpB4=; b=Q7D2zhbtoiNXzgzJGbIBkdfD+YO0500PrQeK3BCxFCH9gbJ35D3NEM/YEvGR1lMqFF 5b9fHiBsKXnauP6vqGfY/4MIqtDj4GweFRZVWaPaZb27XK5j43U6eCxGJEJPsNTvz5Jj LjCsB3ariMC4mNo4ITrX7mXgEcvddhqHi/KPjuDgNBgUEvWT1ndsuJuj4QB73imeQmq7 gcXTPXEuH445JwrD9oD0l+O3OnfofDS0sqS/MJe/131zjayCp2FdGvRB7/G0f83yHEGQ ko5UgTilDgR+b8qathcliZTEVhjKfGfjZloeFlfOAtTQ5n/JwSq4DqsFs975NAmLbqT1 Ak9A== 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 dp16si3382300ejc.17.2020.09.02.03.53.02; Wed, 02 Sep 2020 03:53:25 -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 S1726355AbgIBKtu (ORCPT + 99 others); Wed, 2 Sep 2020 06:49:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:49724 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbgIBKts (ORCPT ); Wed, 2 Sep 2020 06:49:48 -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 00205AD7B; Wed, 2 Sep 2020 10:49:47 +0000 (UTC) Subject: Re: [Patch v4 5/7] mm/hugetlb: a page from buddy is not on any list To: Wei Yang , mike.kravetz@oracle.com, 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: Vlastimil Babka Message-ID: Date: Wed, 2 Sep 2020 12:49:46 +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: <20200901014636.29737-6-richard.weiyang@linux.alibaba.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/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? > /* Fall through */ Maybe delete this comment? This is not a switch statement. > } > hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page); >