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 11E19C433E2 for ; Wed, 2 Sep 2020 10:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD5FD214D8 for ; Wed, 2 Sep 2020 10:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbgIBKtu (ORCPT ); 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); >