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=-8.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 4FB7CC4320A for ; Tue, 31 Aug 2021 16:38:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 002CE6108E for ; Tue, 31 Aug 2021 16:38:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 002CE6108E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8F97A940009; Tue, 31 Aug 2021 12:38:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A8358D0001; Tue, 31 Aug 2021 12:38:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79776940009; Tue, 31 Aug 2021 12:38:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 69BC88D0001 for ; Tue, 31 Aug 2021 12:38:00 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2717D181AEF00 for ; Tue, 31 Aug 2021 16:38:00 +0000 (UTC) X-FDA: 78535932720.23.8692ADD Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf14.hostedemail.com (Postfix) with ESMTP id B12DF600198C for ; Tue, 31 Aug 2021 16:37:59 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 54BE6222DC; Tue, 31 Aug 2021 16:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1630427878; h=from:from:reply-to: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=elr0DzDewaztAa9Pi9knUWjSATe4WGI8ZR1bF2BTblI=; b=ca1HQCk+kvAlRTDp6miDRJQg1r+7t8eGBkgAnfEYyc5SPBFT3IvMRVMBh2WhyRlO3jjm3g Cl9ukvXRDIopHBQOpSC9W3UoMkbszANLBvlqmX3XzptiXhzPDseZb1/QNqR4Gcd9u4IHey YarP7ik60uJnN3Au4NDVogLiBGH1p8U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1630427878; h=from:from:reply-to: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=elr0DzDewaztAa9Pi9knUWjSATe4WGI8ZR1bF2BTblI=; b=4Aqx6NY7rW7aNkS0/7rs2Pk5/VDEkOW0xsKFkHwQex+OowAa1m17C4HSbv/TJ9N6PV402O xVB8DhRmdVPupSDg== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 2F60113A9A; Tue, 31 Aug 2021 16:37:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id 4BW/CuZaLmGzWgAAGKfGzw (envelope-from ); Tue, 31 Aug 2021 16:37:58 +0000 Message-ID: Date: Tue, 31 Aug 2021 18:37:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: [PATCH 6/6] mm/page_alloc.c: avoid allocating highmem pages via alloc_pages_exact_nid() Content-Language: en-US To: Miaohe Lin , Matthew Wilcox Cc: akpm@linux-foundation.org, sfr@canb.auug.org.au, peterz@infradead.org, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210830141051.64090-1-linmiaohe@huawei.com> <20210830141051.64090-7-linmiaohe@huawei.com> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ca1HQCk+; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=4Aqx6NY7; spf=pass (imf14.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B12DF600198C X-Stat-Signature: kpm1raxqcwo9bpp74onduur9tnq6cpm1 X-HE-Tag: 1630427879-626230 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: On 8/31/21 03:56, Miaohe Lin wrote: > On 2021/8/30 22:24, Matthew Wilcox wrote: >> On Mon, Aug 30, 2021 at 10:10:51PM +0800, Miaohe Lin wrote: >>> Don't use with __GFP_HIGHMEM because page_address() cannot represent >>> highmem pages without kmap(). Newly allocated pages would leak as >>> page_address() will return NULL for highmem pages here. But It works >>> now because the only caller does not specify __GFP_HIGHMEM now. >> >> This is a misunderstanding of how alloc_pages_exact() / >> alloc_pages_exact_nid() work. You simply can't call them with >> GFP_HIGHMEM. >> > > Yep, they can't work with GFP_HIGHMEM. So IMO it might be better to > get rid of GFP_HIGHMEM explicitly or add a comment to clarify this > situation to avoid future misbehavior. But this may be a unnecessary > worry... Do you prefer to not change anything here? I agree with the suggestion below... > Many thanks. > >> If you really must change anything here, >> s/__GFP_COMP/(__GFP_COMP|__GFP_HIGHMEM)/g throughout both >> alloc_pages_exact() and alloc_pages_exact_nid(). ... which means __GFP_HIGHMEM would be stripped and additionally there would be a warning.