From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 520DA57C9F for ; Fri, 7 Nov 2025 14:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762525082; cv=none; b=jNvW75/g+a80yu3pOmRqmR7cWCh/QebL3e9yG3zhxG4shphLpCEyZw0aT3v+19aD8Urpp/Zi5Zvfnfpmx2vx/gkzpE3NIqdmXfrivNk0R/XoHhnNdzcsrPtnWzOg4ZuaQuavrup58DnTWGlu6tUzR5KJzlFXUAwhQDGfsBs2UlE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762525082; c=relaxed/simple; bh=ypgxC54yhGj8AxBImWTTquYgjlI2a5opaMOYUrn4f9Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mNLCmxEeC5dkiz8xv0xOQxh4vbolYAP7mB9STOeHZyyUii5jGrRkCwqSoLVyDyrwD8bpt6r5dhkB8lHhrOCXeJtu2lO7uwxfLyRuutDLqgU6+F+lSTeDXLjhcrucKyWWWquGH2FouRA/IRftf1V2hN+hlJZTR6SAVc6N9WwMFc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=sN4IZ86W; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="sN4IZ86W" Message-ID: <46a03f86-ab38-4a6c-b1fb-6f77122eff0d@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762525077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ykW1NxfmAyfPid0Bv9EkP65yYrb8g2y4oaOywpFdm8I=; b=sN4IZ86WVAG4Olc7M1q+EZefrDrYOz9yC7iz6UK+cC19RzbPzIJK9onGxB+RMlrYmMwNDG 4NAW5gu9nibVu2HvO3tsZtbu1IzQf/ELSYqchfavu1h6FnH7B3XS89Nt/3fLjNCmU3Ek6q k0+MPu+biM3cAI81N7L2OS+aok5bVIU= Date: Fri, 7 Nov 2025 22:17:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH Resend] mm: Refine __{pgd,p4d,pud,pmd,pte}_alloc_one_*() about HIGHMEM Content-Language: en-US To: Arnd Bergmann , Huacai Chen Cc: Andrew Morton , Huacai Chen , Jan Kara , Kevin Brodsky , Linux-Arch , linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org, Lance Yang , Lorenzo Stoakes , vishal.moola@gmail.com References: <20251107095922.3106390-1-chenhuacai@loongson.cn> <20251107114455.59111-1-ioworker0@gmail.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2025/11/7 20:50, Arnd Bergmann wrote: > On Fri, Nov 7, 2025, at 12:44, Lance Yang wrote: >> From: Lance Yang >> On Fri, 7 Nov 2025 17:59:22 +0800, Huacai Chen wrote: >>> >>> */ >>> static inline pte_t *__pte_alloc_one_kernel_noprof(struct mm_struct *mm) >>> { >>> - struct ptdesc *ptdesc = pagetable_alloc_noprof(GFP_PGTABLE_KERNEL & >>> - ~__GFP_HIGHMEM, 0); >>> + struct ptdesc *ptdesc = pagetable_alloc_noprof(GFP_PGTABLE_KERNEL, 0); >> >> I looked into the history and it seems you are right. This defensive pattern >> was likely introduced by Vishal Moola in commit c787ae5[1]. > > Right, so not even so long ago, so we need to make sure we agree > on a direction and don't send opposite patches in the name of > cleanups. Yes, better to get on the same page now than to have conflicting cleanups down the line ;) > >> After this cleanup, would it make sense to add a BUILD_BUG_ON() somewhere >> to check that __GFP_HIGHMEM is not present in GFP_PGTABLE_KERNEL and >> GFP_PGTABLE_USER? This would prevent any future regression ;) >> >> Just a thought ... > > I think we can go either way here, but I'd tend towards not > adding more checks but instead removing any mention of __GFP_HIGHMEM > that we can show is either pointless or can be avoided, with Makes sense to me :) > the goal of having only a small number of actual highmem > allocations remaining in places we do care about (normal > page cache, zram, possibly huge pages). Right! That's the ideal end state. Making the code cleaner and the intention clearer ;p Cheers, Lance