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=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 0528DC83006 for ; Wed, 29 Apr 2020 03:27:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AAF982076A for ; Wed, 29 Apr 2020 03:27:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vDtUirzm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAF982076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 50BF58E0007; Tue, 28 Apr 2020 23:27:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E4AF8E0001; Tue, 28 Apr 2020 23:27:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 420848E0007; Tue, 28 Apr 2020 23:27:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 29FBB8E0001 for ; Tue, 28 Apr 2020 23:27:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CEA31181AEF07 for ; Wed, 29 Apr 2020 03:27:11 +0000 (UTC) X-FDA: 76759456662.20.lead40_78fd92187b04c X-HE-Tag: lead40_78fd92187b04c X-Filterd-Recvd-Size: 7548 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:11 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id ms17so212640pjb.0 for ; Tue, 28 Apr 2020 20:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vjSLLHLjivpaTsGjt9wZU4uxvIUbIBAxgk3j0tUoRA0=; b=vDtUirzmzFpjI5hjGRWWmC1lfK3OGlUTM6iParKSOaxrcTMN6d9IdOn8MJuEkZLKhc 2OQ2fIlvuSFQJ+gQsfLYr1Z6ELxfy6ADQHJ7f02esZQXiEf4TAbL5HCZzppCsgoAkhwi BxWmWzbcD7JaBEq0/aimzA4gpSl/Gn/EYXPYeF207HOqZeW49J7zvLIeigZP34VJbdlR ZioWLqysSBIozk4h7dIfliiB3ST9m3h3NGYIrjMYKysZRkOESwZSOhyQPmOTA30EE+b9 tjXoPu4j/p3LURZVzMg55f6+SB2+kAg1fc+UEUo2htrN7Zbv29jmVWyLpXVNS2hAA8h8 WjnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vjSLLHLjivpaTsGjt9wZU4uxvIUbIBAxgk3j0tUoRA0=; b=T9MwP4NuD622u/hbNWDmkGqBj3z++vffWfaX0EupnNXCuiZYIQ0GvEEK8vvK+5rg21 TC/tugSDx3VVkCyO1emyxxqEYMV9Ie2I+Zqsn6x9rdlm7TZJ4RE6eD9Ja4aPVc8z2d0Z Dm11yvD+f3J/iaO+QV+5LYTgT4n6qOm8LOXecBGo4gQayZJsVtuPOnga5mglEYbx5xuM u3qWcEm/c0gyzwBcwrPBZ1f25CJ0MNCmsChdvmDS3sEPnfYAIguG3FAkq87FMs7PeUy8 AvjVH60mv+AOvSafxVARXiykAogZclFVIFTJlz3bwIjhi/zk4W0lvFZ6FOpNMdDJHU30 xIag== X-Gm-Message-State: AGi0PuYA+HGjw7OHJoRDALxFAbIp5OOhqAiorQGeS49Ra9Vsboncktj+ pg8WdqVkT5bsG+5O/fRKeS1M3AlUKio= X-Google-Smtp-Source: APiQypLYh8NdrZBbpGtSDmCzWjniW2sHQJcbgaiMBawm9jRVW3CaZraKl4M5I3z7H2gU67+DMSliiA== X-Received: by 2002:a17:90a:d984:: with SMTP id d4mr678963pjv.59.1588130830450; Tue, 28 Apr 2020 20:27:10 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:09 -0700 (PDT) From: js1304@gmail.com X-Google-Original-From: iamjoonsoo.kim@lge.com To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Laura Abbott , "Aneesh Kumar K . V" , Mel Gorman , Michal Hocko , Johannes Weiner , Roman Gushchin , Minchan Kim , Rik van Riel , Christian Koenig , Huang Rui , Eric Biederman , "Rafael J . Wysocki" , Pavel Machek , kernel-team@lge.com, Christoph Hellwig , Joonsoo Kim Subject: [PATCH v2 02/10] drm/ttm: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:35 +0900 Message-Id: <1588130803-20527-3-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1588130803-20527-1-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: From: Joonsoo Kim Until now, PageHighMem() is used for two different cases. One is to check if there is a direct mapping for this page or not. The other is to check the zone of this page, that is, weather it is the highmem type zone or no= t. Now, we have separate functions, PageHighMem() and PageHighMemZone() for each cases. Use appropriate one. Note that there are some rules to determine the proper macro. 1. If PageHighMem() is called for checking if the direct mapping exists or not, use PageHighMem(). 2. If PageHighMem() is used to predict the previous gfp_flags for this page, use PageHighMemZone(). The zone of the page is related to the gfp_flags. 3. If purpose of calling PageHighMem() is to count highmem page and to interact with the system by using this count, use PageHighMemZone(). This counter is usually used to calculate the available memory for an kernel allocation and pages on the highmem zone cannot be available for an kernel allocation. 4. Otherwise, use PageHighMemZone(). It's safe since it's implementation is just copy of the previous PageHighMem() implementation and won't be changed. I apply the rule #4 for this patch. Acked-by: Roman Gushchin Reviewed-by: Christian K=C3=B6nig Signed-off-by: Joonsoo Kim --- drivers/gpu/drm/ttm/ttm_memory.c | 4 ++-- drivers/gpu/drm/ttm/ttm_page_alloc.c | 2 +- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 2 +- drivers/gpu/drm/ttm/ttm_tt.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_m= emory.c index acd63b7..d071b71 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c @@ -641,7 +641,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *= glob, */ =20 #ifdef CONFIG_HIGHMEM - if (PageHighMem(page) && glob->zone_highmem !=3D NULL) + if (PageHighMemZone(page) && glob->zone_highmem !=3D NULL) zone =3D glob->zone_highmem; #else if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) @@ -656,7 +656,7 @@ void ttm_mem_global_free_page(struct ttm_mem_global *= glob, struct page *page, struct ttm_mem_zone *zone =3D NULL; =20 #ifdef CONFIG_HIGHMEM - if (PageHighMem(page) && glob->zone_highmem !=3D NULL) + if (PageHighMemZone(page) && glob->zone_highmem !=3D NULL) zone =3D glob->zone_highmem; #else if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/t= tm_page_alloc.c index b40a467..847fabe 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -530,7 +530,7 @@ static int ttm_alloc_new_pages(struct list_head *page= s, gfp_t gfp_flags, /* gfp flags of highmem page should never be dma32 so we * we should be fine in such case */ - if (PageHighMem(p)) + if (PageHighMemZone(p)) continue; =20 #endif diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/t= tm/ttm_page_alloc_dma.c index faefaae..338b2a2 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -747,7 +747,7 @@ static int ttm_dma_pool_alloc_new_pages(struct dma_po= ol *pool, /* gfp flags of highmem page should never be dma32 so we * we should be fine in such case */ - if (PageHighMem(p)) + if (PageHighMemZone(p)) continue; #endif =20 diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 2ec448e..6e094dd 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -119,7 +119,7 @@ static int ttm_tt_set_page_caching(struct page *p, { int ret =3D 0; =20 - if (PageHighMem(p)) + if (PageHighMemZone(p)) return 0; =20 if (c_old !=3D tt_cached) { --=20 2.7.4