From patchwork Wed Apr 29 03:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6411F92A 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 244982068E for ; Wed, 29 Apr 2020 03:27:13 +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 244982068E 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4E4AF8E0001; Tue, 28 Apr 2020 23:27:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 2,0,0,7a28d7b5ba41c4a3,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:152:355:379:541:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1543:1593:1594:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2559:2562:2898:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:3872:3874:4118:4321:4385:4605:5007:6119:6261:6653:6742:7576:7903:8957:9413:10004:10400:10450:10455:11026:11638:11657:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13053:13161:13180:13229:13548:13894:14096:14097:14181:14394:14659:14721:14819:19904:19999:21080:21444:21451:21627:21666:21990:30054:30064:30070:30079,0,RBL:209.85.216.67:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none 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 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 not. 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önig 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_memory.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, */ #ifdef CONFIG_HIGHMEM - if (PageHighMem(page) && glob->zone_highmem != NULL) + if (PageHighMemZone(page) && glob->zone_highmem != NULL) zone = 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 = NULL; #ifdef CONFIG_HIGHMEM - if (PageHighMem(page) && glob->zone_highmem != NULL) + if (PageHighMemZone(page) && glob->zone_highmem != NULL) zone = 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/ttm_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 *pages, 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; #endif diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/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_pool *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 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 = 0; - if (PageHighMem(p)) + if (PageHighMemZone(p)) return 0; if (c_old != tt_cached) {