Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13753696pxu; Mon, 4 Jan 2021 03:36:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdhkcttJM4/Z2PNxKsaUmTfobb5pHrcijnwxSBwg6yGSTy5/A85KoYaZlEGCHQXqakpJ/w X-Received: by 2002:a05:6402:45:: with SMTP id f5mr70202795edu.273.1609760214497; Mon, 04 Jan 2021 03:36:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609760214; cv=none; d=google.com; s=arc-20160816; b=RfZX4ZXJ5jw+vD4eZAvRb/0FF7QOKz8V6mcVgEUtsARlXIHRpbi1BsCS4UVlJfG4dm 0k4qAp/Ks9vuDQB3ZG1DAktGrut/SWO4k11BUsjZ+JEhr1yX+QYBNYhJXzUlhX0DqavV OVMEm4ecC0bm0E83uEyvIWcrLBFY0j/vosWkTb/2GdbadVcSVfrl+dNMNvcmddtEmSSs FgznrEpZ2u44wpGuWlYZ79/U3qv5CJEAcXWDGWhSf01fxOARi+3hui8Qy3upff1CKnLm 7PcYK4ADX9ngfb6z0abX8K+6GaJW3CsY00luWbe4kQxJEBJKuFdvf/WamKUrbVRwFDU1 XTvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=XgFO1uKnhAXd2Ls1mCpUjTcZQDpdMc0we0ubzVflEYw=; b=amZJ/miuaxlInEh6YBlxuS5s+/0DIgVJhgnE7W+b/ogLaDx4akOgQofNni3y9jsrX8 kf9rNHNY52Dtl9jNqyQ2NjEHg5p/4fVMIFtH1BP05W1ailc9g+hkmjdyi1IuRdepUHIB rITbF7AVvRbFmz0kO3o3KlsR/9fgHucCsEbPaQFB8deRHkY369+NGp6FnIDnu4FzqFZx NxQA30uSZhSQADktdlMG/kSrcrZ8bGgkXnzVTg43SJqe8TAT2DJKoq05b2+As5FYOoYo g/XoJknODJZn/nOtt3w/DP0KkcckXu8mk6undsof27JkuAiFeXijF2O45xSXqq1E3a4M RotA== 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 jz8si16675514ejb.237.2021.01.04.03.36.30; Mon, 04 Jan 2021 03:36:54 -0800 (PST) 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 S1726306AbhADLfM (ORCPT + 99 others); Mon, 4 Jan 2021 06:35:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:36340 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbhADLfL (ORCPT ); Mon, 4 Jan 2021 06:35:11 -0500 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 9BDC8ACAF; Mon, 4 Jan 2021 11:34:30 +0000 (UTC) To: Arnd Bergmann , Andrew Morton , Nathan Chancellor , Nick Desaulniers , "Kirill A. Shutemov" , Wei Yang Cc: Arnd Bergmann , Dmitry Safonov <0x7f454c46@gmail.com>, Brian Geffon , linux-mm@kvack.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com References: <20201230154104.522605-1-arnd@kernel.org> From: Vlastimil Babka Subject: Re: [PATCH] mm/mremap: fix BUILD_BUG_ON() error in get_extent Message-ID: Date: Mon, 4 Jan 2021 12:34:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20201230154104.522605-1-arnd@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The subject should say BUILD_BUG() On 12/30/20 4:40 PM, Arnd Bergmann wrote: > From: Arnd Bergmann > > clang cannt evaluate this function argument at compile time > when the function is not inlined, which leads to a link > time failure: > > ld.lld: error: undefined symbol: __compiletime_assert_414 >>>> referenced by mremap.c >>>> mremap.o:(get_extent) in archive mm/built-in.a > > Mark the function as __always_inline to avoid it. Not sure if it's the ideal fix, maybe just convert it to BUG() instead? Functions shouldn't really have BUILD_BUG depending on parameters and rely on inlining to make it work... > Fixes: 9ad9718bfa41 ("mm/mremap: calculate extent in one place") I think it's rather this one that introduces the BUILD_BUG() ? c49dd3401802 ("mm: speedup mremap on 1GB or larger regions") > Signed-off-by: Arnd Bergmann > --- > mm/mremap.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/mremap.c b/mm/mremap.c > index c5590afe7165..1cb464a07184 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -336,8 +336,9 @@ enum pgt_entry { > * valid. Else returns a smaller extent bounded by the end of the source and > * destination pgt_entry. > */ > -static unsigned long get_extent(enum pgt_entry entry, unsigned long old_addr, > - unsigned long old_end, unsigned long new_addr) > +static __always_inline unsigned long get_extent(enum pgt_entry entry, > + unsigned long old_addr, unsigned long old_end, > + unsigned long new_addr) > { > unsigned long next, extent, mask, size; > >