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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EE4EC433EF for ; Tue, 5 Oct 2021 05:52:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3A12461207 for ; Tue, 5 Oct 2021 05:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3A12461207 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id CD09B6B006C; Tue, 5 Oct 2021 01:52:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C59C26B0071; Tue, 5 Oct 2021 01:52:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF9CA900002; Tue, 5 Oct 2021 01:52:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 9D73D6B006C for ; Tue, 5 Oct 2021 01:52:50 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 654ED3016A for ; Tue, 5 Oct 2021 05:52:50 +0000 (UTC) X-FDA: 78661314900.12.5FE5770 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf14.hostedemail.com (Postfix) with ESMTP id 1E0F460020AD for ; Tue, 5 Oct 2021 05:52:49 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id w10so20447002ybt.4 for ; Mon, 04 Oct 2021 22:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+5Or6YwkakvRlY3TqLJHeuqMlz9BustpXLPu+C0LRe4=; b=ApP1aKq+szlfar9bGwm1MYzYxtS/iONPZsTDDMuW+bRcyzwXtaAW+jTDqi3jzJ1im3 1bNtG3EDXLGwt326EFz3j2vhuRGaH+Xx2JFbevgxrWAe76WAtmWXGr8fEv37b+vNLN57 tFY42CD9gwKm9LJlmOgeE+RmAoaACMluznKvTqasm2ZQ27QnMG5uNtRRw/oJuZwX4586 giL90Yxx+jIquca39RVE5WZoiyArC9CFua2TzkFvT+JDY/n4h9hsjRtXgKXHxx0ogSe3 lRVGLtRRA5paW4E60sYV+6eT2VlaHogjgN5FRiKjoioHFzv++vvAT+7KNGzHMZnKtUPH 2GTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+5Or6YwkakvRlY3TqLJHeuqMlz9BustpXLPu+C0LRe4=; b=ptzURh6XjPD8+Aa+QRGWYqeEoEKhKo8WA39utdammCO1vXzlM+Bc5EXh2sr+SAyAWb NCL6GR0qIsns+8u5rvoxIRpnyAFPwEEQdoJ6+8/ZiSI5PVJxAOsnIgb0aV5UF3qsl3du 3KlYpaYG4/x0BRx2XFB+dBk8D1lFB57LaNKT8O1SPbS4lrvDnYCpEfc0J34ViDeejhXv ApQlRJHNlwm42yzOx+b9/xFg3OclJzybhu0S1tU4Z8L7OSZZBA4PLOcx+W9zkGtkNJYQ u+gflH/21bln1ZO/kdAvNz0UAKVdA9AyZDmYvvdSLGE8PVqVM2vFrq1C3VJMEqZx/bzX zLiw== X-Gm-Message-State: AOAM5326zxWHCDI6VR0u1MUf/3cyJaoNINzJNZQb2EOi5qq+l3iE+on8 adIwdLytKsbN5ZHBwktK4k0mDYs3ewtvqzYAAAY= X-Google-Smtp-Source: ABdhPJzqIYNwCluWk2vhDUP5lIlJ/+9RFCCSolVGivZYtexdUNw1dw8yRfSg9HyYQyGFdaCfPLK5/sjfZevIt5YgDHQ= X-Received: by 2002:a25:9007:: with SMTP id s7mr20163475ybl.142.1633413169448; Mon, 04 Oct 2021 22:52:49 -0700 (PDT) MIME-Version: 1.0 References: <20211001132220.GA7666@kili> In-Reply-To: <20211001132220.GA7666@kili> From: Zhenguo Yao Date: Tue, 5 Oct 2021 13:52:36 +0800 Message-ID: Subject: Re: [bug report] hugetlbfs: extend the definition of hugepages parameter to support node allocation To: Dan Carpenter Cc: Linux Memory Management List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1E0F460020AD X-Stat-Signature: i471kehykscorg349bgoh9yg5ecggpuz Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ApP1aKq+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of yaozhenguo1@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=yaozhenguo1@gmail.com X-HE-Tag: 1633413169-364725 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: Thanks for your report, I have already updated this patch with the fix. Link: https://lore.kernel.org/lkml/20211005054729.86457-1-yaozhenguo1@gmail= .com/ Dan Carpenter =E4=BA=8E2021=E5=B9=B410=E6=9C=881= =E6=97=A5=E5=91=A8=E4=BA=94 =E4=B8=8B=E5=8D=889:23=E5=86=99=E9=81=93=EF=BC= =9A > > Hello Zhenguo Yao, > > The patch 67b2b441dc10: "hugetlbfs: extend the definition of > hugepages parameter to support node allocation" from Sep 29, 2021, > leads to the following > Smatch static checker warning: > > mm/hugetlb.c:2957 __alloc_bootmem_huge_page() > warn: ignoring unreachable code. > > mm/hugetlb.c > 2940 int __alloc_bootmem_huge_page(struct hstate *h, int nid) > 2941 { > 2942 struct huge_bootmem_page *m; > 2943 int nr_nodes, node; > 2944 > 2945 if (nid >=3D nr_online_nodes) > 2946 return 0; > 2947 /* do node specific alloc */ > 2948 if (nid !=3D NUMA_NO_NODE) { > 2949 m =3D memblock_alloc_try_nid_raw(huge_page_size(= h), huge_page_size(h), > 2950 0, MEMBLOCK_ALLOC_ACCESSIBLE, ni= d); > 2951 if (m) > 2952 goto found; > 2953 else > 2954 return 0; > 2955 } > 2956 /* do all node balanced alloc */ > ^^^^^^^^ > This says that it's going to loop over "all nodes". > > --> 2957 for_each_node_mask_to_alloc(h, nr_nodes, node, &node_sta= tes[N_MEMORY]) { > 2958 m =3D memblock_alloc_try_nid_raw( > 2959 huge_page_size(h), huge_page_siz= e(h), > 2960 0, MEMBLOCK_ALLOC_ACCESSIBLE, no= de); > 2961 /* > 2962 * Use the beginning of the huge page to store t= he > 2963 * huge_bootmem_page struct (until gather_bootme= m > 2964 * puts them into the mem_map). > 2965 */ > 2966 if (m) > 2967 goto found; > 2968 else > 2969 return 0; > > But it only checks the first node and then returns. > > 2970 } > 2971 > 2972 found: > 2973 /* Put them into a private list first because mem_map is= not up yet */ > 2974 INIT_LIST_HEAD(&m->list); > 2975 list_add(&m->list, &huge_boot_pages); > 2976 m->hstate =3D h; > 2977 return 1; > 2978 } > > regards, > dan carpenter