From patchwork Wed Apr 29 03:26:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515945 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 893AD92C for ; Wed, 29 Apr 2020 03:27:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C9E12068E for ; Wed, 29 Apr 2020 03:27:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bNtHgy3N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C9E12068E 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 7582E8E0006; Tue, 28 Apr 2020 23:27:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 72E9C8E0001; Tue, 28 Apr 2020 23:27:07 -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 643AC8E0006; Tue, 28 Apr 2020 23:27:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 4C01C8E0001 for ; Tue, 28 Apr 2020 23:27:07 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0D23F180AD806 for ; Wed, 29 Apr 2020 03:27:07 +0000 (UTC) X-FDA: 76759456494.23.lake58_785013add4421 X-Spam-Summary: 2,0,0,5eac9a702ec79d62,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1535:1544:1605:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2559:2562:2693:2731:3138:3139:3140:3141:3142:3865:3866:3867:3868:3870:3871:3872:3874:4118:4250:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11473:11638:11658:11914:12043:12296:12297:12517:12519:12555:12679:12895:13053:13141:13153:13160:13161:13180:13228:13229:13230:13548:14096:14181:14394:14721:14819:21080:21444:21451:21627:21666:21990:30029:30054:30064:30070:30079,0,RBL:209.85.214.193:@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: lake58_785013add4421 X-Filterd-Recvd-Size: 7457 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:06 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id c21so332972plz.4 for ; Tue, 28 Apr 2020 20:27:06 -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; bh=Unb6vzKYfZVHOut29YQ6Kvm+UYMfQLEK+TJmxHNNGJY=; b=bNtHgy3NUjLmwef1ZHhK57fe3JiO55VlxYKnn5RshIkUTMNjEQ8/R2+4Hox/hDl4Sw BlrWHCBt89hiCS7EtfeMIJiLpnazYudS4VtnG2Mqlac5rz0sN2koMm6vnH8ZahohhMiH IkZCYgsdeC593M0bWx+yBa3myqFB+cwngBfY4Na2par4h98l19BJA4+eOH+ZjIljPwAI 5YpcX6cyBHaFOTv//9m+ziunxBzEQPAY/VfUmaubLTeZZalHI/eNAoOF8DezNFMZstKq MT4r2GgN4BjWDpk/E8qYPoMa3rqYBxXBn+T8G1Gf07YQ9/eztqfXUOpBY7VeJKg47laa ozNw== 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; bh=Unb6vzKYfZVHOut29YQ6Kvm+UYMfQLEK+TJmxHNNGJY=; b=ofRIlr4nQJbCpBfhY6u/ayTzK7iRiB7zrtWW1i63lgt3lwQaKu30x+E73goMI2erUm tk5SulLD2t389cEGER+Osa6Xl88Oa9DoA39WdaKtuY6EwyXRYZPaKgP41lPf0SlpaD/3 P5KvWvk5w0KzEZHQnAw+ESAcCXC3jJvm/PfG0H+raOlxP+tfPeiv58t24B6OMEVlp9YX ZI2AeFdk7Q7xcYnK62U7ZT44yfQwz5nzyg8LE1IV1Bqyfik15vLo4GkERPFFFNnMc/Sp cLF5vbzPJ4EfKW7Dlm8g8+pSI0s9drukDZYMPGFygU83a+97vzfcKSXChx+cmkM7+gdA UI0Q== X-Gm-Message-State: AGi0PubRGuLFv5awwJr8oETKH3RVDDhI1ZwZCUdi7qaTB2ZDfr0tO7GU Hne8f/2MjZS4A33dNVR/Qa0= X-Google-Smtp-Source: APiQypLJDJ3XJJjcn6kAUugNzwdYBhQTpB+OKL/tKKH2CCSDLf6KN4mrZ6Rb5Skm00Ui641/P4TW2w== X-Received: by 2002:a17:902:d30a:: with SMTP id b10mr18608241plc.3.1588130825605; Tue, 28 Apr 2020 20:27:05 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:05 -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 01/10] mm/page-flags: introduce PageHighMemZone() Date: Wed, 29 Apr 2020 12:26:34 +0900 Message-Id: <1588130803-20527-2-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> 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 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. Until now, both the cases are the perfectly same thing. So, implementation of the PageHighMem() uses the one case that checks if the zone of the page is the highmem type zone or not. "#define PageHighMem(__p) is_highmem_idx(page_zonenum(__p))" ZONE_MOVABLE is special. It is considered as normal type zone on !CONFIG_HIGHMEM, but, it is considered as highmem type zone on CONFIG_HIGHMEM. Let's focus on later case. In later case, all pages on the ZONE_MOVABLE has no direct mapping until now. However, following patchset "mm/cma: manage the memory of the CMA area by using the ZONE_MOVABLE" , which is once merged and reverted, will be tried again and will break this assumption that all pages on the ZONE_MOVABLE has no direct mapping. Hence, the ZONE_MOVABLE which is considered as highmem type zone could have the both types of pages, direct mapped and not. Since the ZONE_MOVABLE could have both type of pages, __GFP_HIGHMEM is still required to allocate the memory from it. And, we conservatively need to consider the ZONE_MOVABLE as highmem type zone. Even in this situation, PageHighMem() for the pages on the ZONE_MOVABLE when it is called for checking the direct mapping should return correct result. Current implementation of PageHighMem() just returns TRUE if the zone of the page is on a highmem type zone. So, it could be wrong if the page on the MOVABLE_ZONE is actually direct mapped. To solve this potential problem, this patch introduces a new PageHighMemZone() macro. In following patches, two use cases of PageHighMem() are separated by calling proper macro, PageHighMem() and PageHighMemZone(). Then, implementation of PageHighMem() will be changed as just checking if the direct mapping exists or not, regardless of the zone of the page. 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. My final plan is to change the name, PageHighMem() to PageNoDirectMapped() or something else in order to represent proper meaning. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- include/linux/page-flags.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 222f6f7..fca0cce 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -378,10 +378,16 @@ PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND) /* * Must use a macro here due to header dependency issues. page_zone() is not * available at this point. + * PageHighMem() is for checking if the direct mapping exists or not. + * PageHighMemZone() is for checking the zone, where the page is belong to, + * in order to predict previous gfp_flags or to count something for system + * memory management. */ #define PageHighMem(__p) is_highmem_idx(page_zonenum(__p)) +#define PageHighMemZone(__p) is_highmem_idx(page_zonenum(__p)) #else PAGEFLAG_FALSE(HighMem) +PAGEFLAG_FALSE(HighMemZone) #endif #ifdef CONFIG_SWAP 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) { From patchwork Wed Apr 29 03:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515949 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 EA90892A for ; Wed, 29 Apr 2020 03:27:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B88C12083B for ; Wed, 29 Apr 2020 03:27:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XyaUIW/R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B88C12083B 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 02BA98E0008; Tue, 28 Apr 2020 23:27:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 001EE8E0001; Tue, 28 Apr 2020 23:27:16 -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 E80E08E0008; Tue, 28 Apr 2020 23:27:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id D0EFD8E0001 for ; Tue, 28 Apr 2020 23:27:16 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7FE58180AD806 for ; Wed, 29 Apr 2020 03:27:16 +0000 (UTC) X-FDA: 76759456872.23.owner18_79afd2751fc57 X-Spam-Summary: 2,0,0,91efc9b4c7a6cb64,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2559:2562:2898:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:4321:4385:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11638:11658:11914:12296:12297:12517:12519:12555:12679:12895:13053:13069:13161:13180:13229:13311:13357:13548:14096:14181:14384:14394:14721:14819:21080:21325:21444:21451:21627:21666:30054:30064:30070:30079,0,RBL:209.85.216.68:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.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:24,LUA_SUMMARY:none X-HE-Tag: owner18_79afd2751fc57 X-Filterd-Recvd-Size: 5313 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:16 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id a32so211420pje.5 for ; Tue, 28 Apr 2020 20:27:16 -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; bh=dDZ1MgpmhJ05Zf8jhPCyAD6OUKmqbz/zL2ik7cD9hVA=; b=XyaUIW/R1YgoWjppehedCHz7ersMbBGxynOYTQO4mdAbWylRcXcgm9rAc3l8H9jwTt Q0ZMYyVifmbLC3MrPLvU+d5sYUwjiOJHmD7InEFGJ3bb52c7d+Sz/vop+GDBx2SYmFcz 2b5PlQCKHq2H0QrFfDTDp/9IFPb+Vc/3mi3pvZQ1ouZ18g3z2esZ/UMf84WZphqQIIwG ujJqUEx2InMv4DESByAlMLJ7LVGRql3PDtdOu7dlIzaX4fjMTU+WQkkMJtyKKDRl7J/3 N9T1oTPbCGbF3BKNUcRPZR33JCrGfQyUHCB4AUurlaBxiC+ykJxPTyw2RHsrK7NTk+HW TH/w== 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; bh=dDZ1MgpmhJ05Zf8jhPCyAD6OUKmqbz/zL2ik7cD9hVA=; b=CXyNeULm0vIwlwZWV0YHzjhEQyPoUGFvByROLkzGLzG4CpgoqwfYkYXD99CpWqi88+ RYS2vBF6ETGZ7eioaHu4KDNGnPFrNhRaH/6TtEjS93dL5nlQTJ9jWbijtG0SJiGNjg5A wwCtV8be96v+exSpw3UuybuZN0zCHG/HB0w2NWCDQFodJLVLkvjQuoKJ89oVilesAVNi vVKnpSDg2Ks/AuxW74iTH9/atCXvYc6t/DWxjMloPe6JyHBwyV1WBfYcGGurYXB3xyJ1 oLbCLi0DyTCpG+WsKhR1nY4Nt7opH2Sw9h/gPEKvKliGR+zJEbjeEGJxvVnEpaR5N3lm SZ3Q== X-Gm-Message-State: AGi0PuaBHtT6Ce2dPG5TCze496vcmCJ3YNeOmnJkV988h7MSSk5lo7Wi QYWRT/WLYCi+pf8rk61Ttdk= X-Google-Smtp-Source: APiQypIRlTvB9SPWsgtNua1iaxMRY446Rpmb6K2vJAYeZWRp53SGoJPF0UpH2ZcmKgC5V5cCmAXFxA== X-Received: by 2002:a17:90a:cb09:: with SMTP id z9mr754586pjt.120.1588130835256; Tue, 28 Apr 2020 20:27:15 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:14 -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 03/10] kexec: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:36 +0900 Message-Id: <1588130803-20527-4-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> 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 #2 for this patch. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim Nacked-by: "Eric W. Biederman" --- kernel/kexec_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index ba1d91e..33097b7 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -766,7 +766,7 @@ static struct page *kimage_alloc_page(struct kimage *image, * gfp_flags honor the ones passed in. */ if (!(gfp_mask & __GFP_HIGHMEM) && - PageHighMem(old_page)) { + PageHighMemZone(old_page)) { kimage_free_pages(old_page); continue; } From patchwork Wed Apr 29 03:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515951 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 F38D292A for ; Wed, 29 Apr 2020 03:27:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B5EB82068E for ; Wed, 29 Apr 2020 03:27:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rs9+Ni8w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5EB82068E 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 EA9608E0009; Tue, 28 Apr 2020 23:27:21 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E814A8E0001; Tue, 28 Apr 2020 23:27:21 -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 D96F28E0009; Tue, 28 Apr 2020 23:27:21 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id C38598E0001 for ; Tue, 28 Apr 2020 23:27:21 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8F75549960B for ; Wed, 29 Apr 2020 03:27:21 +0000 (UTC) X-FDA: 76759457082.01.toad32_7a6ba95460b0c X-Spam-Summary: 2,0,0,59b4448324025aed,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1543:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2559:2562:2898:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3871:3872:3874:4117:4321:4385:5007:6119:6261:6653:6742:7576:7903:8957:9413:10004:11026:11232:11473:11638:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:13053:13161:13180:13229:13548:14096:14181:14394:14721:14819:21080:21325:21444:21451:21627:21666:21740:21990:30054:30064:30070:30079,0,RBL:209.85.215.195:@gmail.com:.lbl8.mailshell.net-62.18.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:24,LUA_SUMMARY:none X-HE-Tag: toad32_7a6ba95460b0c X-Filterd-Recvd-Size: 6924 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:21 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id d3so367672pgj.6 for ; Tue, 28 Apr 2020 20:27:21 -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; bh=h4/eFw0vWwBVRaZ/3UIgJHxLSvTZ3eLOl09I88FAedw=; b=rs9+Ni8w22sXa2fxOCse9k1u5KKvpq45u6RYgFD5LUjVWiQJ/O9bc0lxa7v4eq5hdI BQkya5ZqzYtX0fd2dUOt1QRWJ8FKBKayS+ow0GjDI3u1P3KeSjyI2bKCSdaw6WoqiBQH 7XzJVvu50l15zTz2KqNrRT5/qP7o8y7pg4JJdSsImjSy/siN+6EtIsJdR+yuYcXAi+X3 IPiynHNv2JbUeYZs1TPRpS39c8KtFWo/Rx3nyBOx/cJMqhN7qk9VZNhS2EKYjsXGk4+o ExeY4tLlYL4ulNjzKW3B4jqIAGVt3fw9K1pB/zr5HbjfDi7vZK3rNZJuq/mbF8U8Mw6N 0gDA== 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; bh=h4/eFw0vWwBVRaZ/3UIgJHxLSvTZ3eLOl09I88FAedw=; b=dt9rcYL4bDQrMyDfOTnDXUzRLQfdbtzNXkkYi+HHzuzEetgxNcGUkC7lichBWtYkkU k0r160HFUb2PJpqD+IXoG/cWRqn4+FoQHY8HOy5GiF0Dzq3AEQPCfjc1eCso2U03M2V5 S3cug61efTY+LxjMCuyYedANJGBgX5wqOa2MoCWHfDOKNbqqH0IyhRch2Os56vdZ7grX 26wapqoB61H7FmGgFMGmnlFfJKAoi3al4qNbuYH5fkDEdrTojNumPZOkoEobzlEcVvKp 9Avprb+xemRMWMzWHZAk3ZQ7kPrAX6XOCz2iS94IC7MKcmRsoJTxL7BPyKLe21YLVeM1 LVVQ== X-Gm-Message-State: AGi0PuZbyzFVpO/ZUz77SFU3FgeV/J/JzAUD89zhs3sl/oqY7vKA5R3x TS2TE9RTfYFXEQ0aQOxWfYc= X-Google-Smtp-Source: APiQypKEbzHnKMzCKX/ncGYbZgq1pAvZNsSE1f4dlTDfmYezOsLJMtfjO4PiP2/R4GsGUKyg6wWRyw== X-Received: by 2002:a62:6807:: with SMTP id d7mr33624182pfc.296.1588130840165; Tue, 28 Apr 2020 20:27:20 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:19 -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 04/10] power: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:37 +0900 Message-Id: <1588130803-20527-5-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> 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 #3 for this patch. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- kernel/power/snapshot.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 6598001..be759a6 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1227,7 +1227,7 @@ static struct page *saveable_highmem_page(struct zone *zone, unsigned long pfn) if (!page || page_zone(page) != zone) return NULL; - BUG_ON(!PageHighMem(page)); + BUG_ON(!PageHighMemZone(page)); if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) return NULL; @@ -1291,7 +1291,7 @@ static struct page *saveable_page(struct zone *zone, unsigned long pfn) if (!page || page_zone(page) != zone) return NULL; - BUG_ON(PageHighMem(page)); + BUG_ON(PageHighMemZone(page)); if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) return NULL; @@ -1529,7 +1529,7 @@ static unsigned long preallocate_image_pages(unsigned long nr_pages, gfp_t mask) if (!page) break; memory_bm_set_bit(©_bm, page_to_pfn(page)); - if (PageHighMem(page)) + if (PageHighMemZone(page)) alloc_highmem++; else alloc_normal++; @@ -1625,7 +1625,7 @@ static unsigned long free_unnecessary_pages(void) unsigned long pfn = memory_bm_next_pfn(©_bm); struct page *page = pfn_to_page(pfn); - if (PageHighMem(page)) { + if (PageHighMemZone(page)) { if (!to_free_highmem) continue; to_free_highmem--; @@ -2264,7 +2264,7 @@ static unsigned int count_highmem_image_pages(struct memory_bitmap *bm) memory_bm_position_reset(bm); pfn = memory_bm_next_pfn(bm); while (pfn != BM_END_OF_MAP) { - if (PageHighMem(pfn_to_page(pfn))) + if (PageHighMemZone(pfn_to_page(pfn))) cnt++; pfn = memory_bm_next_pfn(bm); @@ -2541,7 +2541,7 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca) return ERR_PTR(-EFAULT); page = pfn_to_page(pfn); - if (PageHighMem(page)) + if (PageHighMemZone(page)) return get_highmem_page_buffer(page, ca); if (swsusp_page_is_forbidden(page) && swsusp_page_is_free(page)) From patchwork Wed Apr 29 03:26:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515953 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 E63E392A for ; Wed, 29 Apr 2020 03:27:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A9DE1208E0 for ; Wed, 29 Apr 2020 03:27:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sSiiNusd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9DE1208E0 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 DBF3B8E000A; Tue, 28 Apr 2020 23:27:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D96A38E0001; Tue, 28 Apr 2020 23:27:26 -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 CACA78E000A; Tue, 28 Apr 2020 23:27:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id B32618E0001 for ; Tue, 28 Apr 2020 23:27:26 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 750D9583A for ; Wed, 29 Apr 2020 03:27:26 +0000 (UTC) X-FDA: 76759457292.21.bread87_7b2289a875f18 X-Spam-Summary: 2,0,0,3c0a12a201a7d95b,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3872:3874:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11473:11638:11658:11914:12296:12297:12517:12519:12555:12679:12895:13053:13069:13161:13180:13229:13311:13357:13548:14096:14181:14384:14394:14721:14819:21080:21444:21451:21627:21666:30054:30064:30070:30079,0,RBL:209.85.216.66:@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:22,LUA_SUMMARY:none X-HE-Tag: bread87_7b2289a875f18 X-Filterd-Recvd-Size: 5233 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:26 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id e6so206243pjt.4 for ; Tue, 28 Apr 2020 20:27:25 -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; bh=I0oqOMj56XIKW63HotLmokAMCg2A69VeVE+VeYYlJqg=; b=sSiiNusdHjtGcx9VfYZIVguqdiKCZ0+BasEaW5yOJTOTyDh4u8YL1ORr4G9qIJUxbo nSvYaxGLxDFyxIH53CVrltoeGcYiiFhjaLdfXIVeGSwZQWdfZLfS0j+gwW+wpaInAorF ngzmAjj764tUNH68D5quXiqyAfW6Ynny7Y1Y+IpzwokcK10DYqu/bqupN5W17IDaTwbt sHdGr70UYcd0PEeTiS0B6SotKHEBWri6+HImnnFZCjEOeqR6w7E06axV4L4kg7GSfdac NQcuOGfEm2VmhkaOhhvyc4qmJe89cDPAli+T56cJQ/YL5ODp4K4MePS+6DTZ1jWmfRje Z5Jw== 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; bh=I0oqOMj56XIKW63HotLmokAMCg2A69VeVE+VeYYlJqg=; b=LgE5f+AvaHn93khrz0Xn1jksbpyav6ACE0vnQMXskCVE+h14+Z+awzGLwGE/++uLTH RuQGapcNFGsgNO9wQ4r8VzPEJC3X9Xc8EBNXOuBMe3aBXLa9ODi5l1Ad70S1HSxNCWSj lKwpwG3mt8h+rxDlCHoJUxnSIJi0vgRPN30amjmRsUjnm4xJx8FZjIZh501RVM72Uyi2 J7SSEO3HmZxHDRWahGuhw6SpQMOj1F2CUVa7bopIjq/RzaGem4d6oYBMlqW+E33Z/Mz1 L3FGwSTUBmAb3Y/ceCF7s21GyaR4Ll3diClXFmtY89OkzkSu/lPrOpp/6kNe1N5eWSxr Hszg== X-Gm-Message-State: AGi0PuZva3cAWPcY+nPWs1rcgkLQ+3EChI5ZljVj0jOoSQ6XiQjHCAer 3ecR8Qq1HNW6JEwFbvKNU2U= X-Google-Smtp-Source: APiQypJ4M3fjAxtASvxWVCQ/MQVKg3iL+P6Y3uu3OuaLllA7y3piEPYMI/B3S1mfESsnTnFFOXzVUg== X-Received: by 2002:a17:902:bc86:: with SMTP id bb6mr17376253plb.243.1588130845146; Tue, 28 Apr 2020 20:27:25 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:24 -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 05/10] mm/gup: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:38 +0900 Message-Id: <1588130803-20527-6-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> 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 #2 for this patch. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 11fda53..9652eed 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1608,7 +1608,7 @@ static struct page *new_non_cma_page(struct page *page, unsigned long private) */ gfp_t gfp_mask = GFP_USER | __GFP_NOWARN; - if (PageHighMem(page)) + if (PageHighMemZone(page)) gfp_mask |= __GFP_HIGHMEM; #ifdef CONFIG_HUGETLB_PAGE From patchwork Wed Apr 29 03:26:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515955 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 DA04592A for ; Wed, 29 Apr 2020 03:27:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A73792068E for ; Wed, 29 Apr 2020 03:27:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YHm1orTY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A73792068E 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 DE5768E000B; Tue, 28 Apr 2020 23:27:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D96008E0001; Tue, 28 Apr 2020 23:27:31 -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 CABB18E000B; Tue, 28 Apr 2020 23:27:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id B039D8E0001 for ; Tue, 28 Apr 2020 23:27:31 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 725DC181AEF07 for ; Wed, 29 Apr 2020 03:27:31 +0000 (UTC) X-FDA: 76759457502.09.cake07_7bdabb6b0a733 X-Spam-Summary: 2,0,0,4dd972683cae9dca,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2559:2562:2898:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3872:3874:4321:4385:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11638:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13053:13069:13161:13180:13229:13255:13311:13357:13548:14096:14181:14384:14394:14721:14819:21080:21444:21451:21627:21666:21990:30054:30064:30070:30079,0,RBL:209.85.216.66:@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:25,LUA_SUMMARY:none X-HE-Tag: cake07_7bdabb6b0a733 X-Filterd-Recvd-Size: 5312 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:30 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id 7so1843853pjo.0 for ; Tue, 28 Apr 2020 20:27:30 -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; bh=xBEYuUoQ8e6Da7eJez+k7YxQ5sLYFa5M+7QyRrMMcew=; b=YHm1orTYXSGPPZ6rqzsy/Z/aCobIKLDOgp51Ebnl4u0atgV1seGtUvn3mvdSefeL0Z vrTYiCYMoXXmkOAiEyE6Ry3VQW9HjOiFO54tdgL6mm/rhzb/67x4Kl2dym1y448PxHVf sIETeXeYrRQBYv3OAE+ieKZCXJrSm6TzbJWwOhrxaAmJzPor4gWC4kqExLtmgAbxrqxk n9G4MjSlV/+pnc8q39kVqp5qs6wAMCro8PwBaP8WKYjjvElE8LsGatoLohA/hXjEjnQJ arahQkyJ1rTe4qhEcx2D1A837Qa/Zx+jZlOg4hDscCjyMeHzeoup+J7fUdIzZSXU0oIn Ne7A== 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; bh=xBEYuUoQ8e6Da7eJez+k7YxQ5sLYFa5M+7QyRrMMcew=; b=M6m19asuyAoA/VwWRoVO5WDrEF1+fiwWdnlPsUCZBEGbARX0DNs7GJVTDzkurauno/ vpmq15m7bNkH866l1MRkbksuOgfbZwyXOTcHGiFG7FGEZ3Qzt6/Xnd2GK/G81EO9UyJx Fwer50Sw7uIVISem3d8FlGaa2P3jwelJGmyyp5rBJ5hb8wXJQcxuu9HG/u6GJCJ/VTxQ l2Gkb8CBQGcu+xpGobIZ0Zqi3wrfjCVP8PIis/zY5roqZUTmCsFlANivJjEFCjyOYfNp LRlNPag3rvHVuqkdlAxAvW5FPXyYt33xm06RUt7U8yxZJqrqMxC/kH+XVoNuppTLoqkS VqFA== X-Gm-Message-State: AGi0PuZf9gKaylXUYC42FcPSKYtRIRPuKI+wwmQrnaGPrWYIqFdRtqAh 3/aVlVqp01yq+fQ975PL4zo= X-Google-Smtp-Source: APiQypIMe4cvTWcJXIHZJ0unZHCNL7cX9pPrPhdcmwMdDewi2uTows2IMF6+5o/DmWzKsJrROyXIkw== X-Received: by 2002:a17:90b:93:: with SMTP id bb19mr736039pjb.134.1588130850170; Tue, 28 Apr 2020 20:27:30 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:29 -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 06/10] mm/hugetlb: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:39 +0900 Message-Id: <1588130803-20527-7-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> 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 #3 for this patch. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5548e88..56c9143 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2639,7 +2639,7 @@ static void try_to_free_low(struct hstate *h, unsigned long count, list_for_each_entry_safe(page, next, freel, lru) { if (count >= h->nr_huge_pages) return; - if (PageHighMem(page)) + if (PageHighMemZone(page)) continue; list_del(&page->lru); update_and_free_page(h, page); From patchwork Wed Apr 29 03:26:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515957 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 CE0C192C for ; Wed, 29 Apr 2020 03:27:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9AE142082E for ; Wed, 29 Apr 2020 03:27:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dHGQTgST" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AE142082E 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 CD3F08E000C; Tue, 28 Apr 2020 23:27:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CABB28E0001; Tue, 28 Apr 2020 23:27:36 -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 BE8D38E000C; Tue, 28 Apr 2020 23:27:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id A81DA8E0001 for ; Tue, 28 Apr 2020 23:27:36 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 655B0824999B for ; Wed, 29 Apr 2020 03:27:36 +0000 (UTC) X-FDA: 76759457712.01.spoon29_7c940894d051b X-Spam-Summary: 2,0,0,0f6232343e84151a,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1542:1711:1730:1747:1777:1792:2194:2196:2198:2199:2200:2201:2393:2559:2562:2731:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3872:3874:4321:4385:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11638:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13053:13161:13180:13229:13548:14096:14181:14394:14721:14819:21080:21444:21451:21627:21666:30054:30064:30070:30079,0,RBL:209.85.210.193:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.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:24,LUA_SUMMARY:none X-HE-Tag: spoon29_7c940894d051b X-Filterd-Recvd-Size: 5754 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:35 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id r14so443695pfg.2 for ; Tue, 28 Apr 2020 20:27:35 -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; bh=JcqYhJSvA4X5ViJ5goqbeTTWp8Y5g5DbmVru2JNvJmM=; b=dHGQTgST4T/TIqKzXeO1Lte1bWF1Sn8daJICVO/jnep/VSjF93foldTAiudSwZd4M4 DsevD5RNclIkEf8EaePx82k+CvnKdkwXbmro/CUQyPcGq/mc3Wp0BN7gWGpgFEAP3IQP l+LEP7P0xuKWDNSW5UcGWFnxK/GxZ7cYrtp4gFOeEicD7Q2W72WSJIELL0WC6wcMaOub dOTkdrNdbRsrqXgRitrmKzgdF3oCZobjw1Pe1HpHjAFUHKq6MBTUQipMTLAA+4gFhUPq 5ItG7NGS1KeceRJV6kEml4XfHRazM3PnRMTnzDd3fP7UX3r3Y3ejZtTmbW3a+oa61aDa L0Ng== 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; bh=JcqYhJSvA4X5ViJ5goqbeTTWp8Y5g5DbmVru2JNvJmM=; b=H9kBFrMCTi3K8lCsFqemfFEXWQiegsbc/VYkxpXeoynyjlwkDJQWigMADMChrMhdD0 RGz7fA6+K6OTIcG2vkbGztEaWSi6tW3F0QLbvbfOCEF1SwPzcD1wA84fkXlsmsRRYaVQ odTqyaBQQbWQCJOWyC8GW8rpUub2tdg7e9UjWAhB45e23gOiIGdT5QRs7kslHu832pZY TR8Hr+EHYFbOlHlj0KCc67o1xsiIfZuZkt47uhQBwhi+cT38wASN7r1jFtiqwuRBZMKU Ex84m1iIZHTzcg9Tje8JVnVlPD7OmFgNQL49PNVxt+z4uPrifXZm03dd8Kp6dZXXXTLx 7vwA== X-Gm-Message-State: AGi0PuZaBttkIMViWhfxgKH9T+Zy4i6TIG0C2gtraEWyfoKzqr/kwrSR rs5MvGW/MvV2a6SzFZe78aM= X-Google-Smtp-Source: APiQypJvFpozove4ZkEvpi5UVfGHd8oJpvNm4lin405Dltd2Ts33exbfBSDpzHd66pfNS2AIZ90rDA== X-Received: by 2002:a65:5947:: with SMTP id g7mr31093218pgu.258.1588130854997; Tue, 28 Apr 2020 20:27:34 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:34 -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 07/10] mm: separate PageHighMem() and PageHighMemZone() use case Date: Wed, 29 Apr 2020 12:26:40 +0900 Message-Id: <1588130803-20527-8-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> 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 #3 for this patch. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 555137b..891c214 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -593,7 +593,7 @@ void generic_online_page(struct page *page, unsigned int order) __free_pages_core(page, order); totalram_pages_add(1UL << order); #ifdef CONFIG_HIGHMEM - if (PageHighMem(page)) + if (PageHighMemZone(page)) totalhigh_pages_add(1UL << order); #endif } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index fc5919e..7fe5115 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7444,7 +7444,7 @@ void adjust_managed_page_count(struct page *page, long count) atomic_long_add(count, &page_zone(page)->managed_pages); totalram_pages_add(count); #ifdef CONFIG_HIGHMEM - if (PageHighMem(page)) + if (PageHighMemZone(page)) totalhigh_pages_add(count); #endif } From patchwork Wed Apr 29 03:26:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515959 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 AFCD392C for ; Wed, 29 Apr 2020 03:27:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7DE3F208E0 for ; Wed, 29 Apr 2020 03:27:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X7xH1293" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DE3F208E0 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 9EEF18E000D; Tue, 28 Apr 2020 23:27:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 99E948E0001; Tue, 28 Apr 2020 23:27:41 -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 88E018E000D; Tue, 28 Apr 2020 23:27:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id 705508E0001 for ; Tue, 28 Apr 2020 23:27:41 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2312E824999B for ; Wed, 29 Apr 2020 03:27:41 +0000 (UTC) X-FDA: 76759457922.24.brush11_7d43aa2378536 X-Spam-Summary: 2,0,0,202689931474cb6e,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1534:1540:1711:1714:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3351:3865:3867:3871:3872:4321:5007:6119:6261:6653:6742:7576:8957:9413:10004:11026:11473:11658:11914:12295:12296:12297:12517:12519:12555:12679:12895:13069:13311:13357:14096:14181:14384:14394:14721:21080:21444:21451:21627:21666:30054:30064:30070,0,RBL:209.85.210.196:@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: brush11_7d43aa2378536 X-Filterd-Recvd-Size: 4311 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:40 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id x77so446888pfc.0 for ; Tue, 28 Apr 2020 20:27:40 -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; bh=jN6OWGZfzhz5cy8NH2EykEDo9H91RlV0Cb10AXbRh+4=; b=X7xH1293dienMFUF4Cx9EMFvcB0WqWvKSdXLSakGPz9VAaJgR5Rp27zddaF/mgBDWJ jueccWhjSMYdgmbHtRyzWn7s3QmL+K7gxIsAWZdL/KoIlDZICUr1kKmqxW8pBuvLxo3M hMm9lL77QLGsa5xpvuGlaOin3uwvSqolrCIiw4WVLuakiZNZBeg/nQEMNYhlcbw3OJVd 62Ukj+wbkKaaSNlrnnexEedfYZDoAp5dmdkltB9GFzrEnQiv0H720MbDH2oOUTsX/FIb l9EwFJu7W8HYh/UIqUDaR5FvacZnO6I7X5qH7gzSiye3TYD7Jwk+dBBJlk+/rKxG52s3 NieA== 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; bh=jN6OWGZfzhz5cy8NH2EykEDo9H91RlV0Cb10AXbRh+4=; b=diaRFf0hsomglLBrs6+bTGsC6voUsz+9PekBHQalwioIj99dcRfzVfYkbHe/7yEAQH Ap+QT4vm6s3Nna/7bgzqMulcpp3I1nfFomLzxuwnm3MLdy+BdkpMMomK1SjGsTPht+QC /KTNaTNRDAOoflSXNOhEAlxDUYYkhWtDDIZi03WdlkjZ4a4hK4vEDFpz76rH6hKR6VFy i9kUPeuaLMxLZWsngs0GPMRAfSdExTYnSEja+iwPkX7vHMppZJzL5sjVaaBL3iCl51ow MRs14M9UpUX4emNK3NEWF6ZjCTA6NOQmGM8ZWREhgjfwtTrO/MYXpXYmoKBQ1Cj1qT8p WVgA== X-Gm-Message-State: AGi0PuYhJC442T0BvLmHWS646YcgU8VP0eWVHaOcixwNxVlnaKqDR9ia i2mY0w10XMI4PAqz+6IY8E8= X-Google-Smtp-Source: APiQypInVbH7ylHMhU07Tfmqu8yaakpX3/HbtkY8RGK6W+4l2MkEeAn29ptQFf/Lvq2iASEnh+35qw== X-Received: by 2002:a62:e113:: with SMTP id q19mr32206900pfh.107.1588130859931; Tue, 28 Apr 2020 20:27:39 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:39 -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 08/10] mm/page_alloc: correct the use of is_highmem_idx() Date: Wed, 29 Apr 2020 12:26:41 +0900 Message-Id: <1588130803-20527-9-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> 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 What we'd like to check here is whether page has direct mapping or not. Use PageHighMem() since it is perfectly matched for this purpose. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7fe5115..da473c7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1399,7 +1399,7 @@ static void __meminit __init_single_page(struct page *page, unsigned long pfn, INIT_LIST_HEAD(&page->lru); #ifdef WANT_PAGE_VIRTUAL /* The shift won't overflow because ZONE_NORMAL is below 4G. */ - if (!is_highmem_idx(zone)) + if (!PageHighMem(page)) set_page_address(page, __va(pfn << PAGE_SHIFT)); #endif } From patchwork Wed Apr 29 03:26:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515961 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 4025F92A for ; Wed, 29 Apr 2020 03:27:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0D7C32087E for ; Wed, 29 Apr 2020 03:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k8AN/GDe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D7C32087E 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 003688E000E; Tue, 28 Apr 2020 23:27:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EF61F8E0001; Tue, 28 Apr 2020 23:27:46 -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 E0C1F8E000E; Tue, 28 Apr 2020 23:27:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id CB3B98E0001 for ; Tue, 28 Apr 2020 23:27:46 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8E661180AD806 for ; Wed, 29 Apr 2020 03:27:46 +0000 (UTC) X-FDA: 76759458132.04.light42_7e0b652859a3f X-Spam-Summary: 2,0,0,81a1cbfe0d8d0f55,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2731:3138:3139:3140:3141:3142:3352:3865:3866:3867:3870:3874:5007:6261:6653:6742:7576:8957:9413:10004:11026:11473:11638:11658:11914:12043:12296:12297:12438:12517:12519:12555:12663:12679:12895:13069:13311:13357:14096:14181:14384:14394:14721:21080:21444:21451:21627:21666:21990:30054:30064:30070,0,RBL:209.85.210.194:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.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: light42_7e0b652859a3f X-Filterd-Recvd-Size: 4721 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:46 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id 18so426315pfv.8 for ; Tue, 28 Apr 2020 20:27:45 -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; bh=muaMvVRvtjif1FDtMnzRTyXTeXTgI5C5K36AlArPZQc=; b=k8AN/GDeTBchP4fwIbxkOgddQWIgIffopQu3L3mCelIC0WH5OlOaFYq2vr9jCIS2Dp 2krdBtEqJbZzTxYlKup706YS+rz81b7bXBV/3IOJbUQY4AMEz7nR75/FyUvfKnt5jLfd pHdpLx4coUMCwvx7y39jdSiiFTFwKkbOhb4zvM/RVj22Ll7D9emJQdsz1n83bKg5AQyf bIGIa9R6PKXn1WH131aPrpcpTgwZ9FZ07DtTEl/XzfliTX0h39bHIyeOwagSxbLGI4GH zsrA+pq3wHVgHXeFHDOzyS5fvCFGZXGD/Tu0VwQGRP3A+SCC6st0oOkQyCK6eJJVw9DL rJGw== 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; bh=muaMvVRvtjif1FDtMnzRTyXTeXTgI5C5K36AlArPZQc=; b=NlZ4M7hGNlD6AW2LW2+Zdu97qME+XRdiEt2c4/JlyxBTUOf9mNBthT5s2v4fFbWbcb 2cxRtWsKCqX7Jrmn1Vh/cS5WaOGjgSq0WNhvnViLwCUqdfisUWV8w7Ygv5TLcc3be8i6 e+r57HMnJz6d7Eg/55iKdWjaNCe6yp/95nbU7ZHHdS2lyMg8vvhWHMlh29FBLkykSL+Y 23LeU5ljjAYiH1KjAgNdrStu3uMTM+kxvqOo1ySrfITnkR3HEkR5rrVovcmaNN93V09b nmhzmJ6ROERdJig94frm9BIqH6l32tgp9gNZtiVSpnSWt/Pg1MmrL0+sfBYNYzy1Xsuo UC8g== X-Gm-Message-State: AGi0PubrbuKezzxWXo1j1L2TnNSADfqWkLuW+ClH6bRm07b+gEv/6QSf YAJiRmoVQyk9Xy5FU6Le4fo= X-Google-Smtp-Source: APiQypIOlvX1ynHI0c0eTMrkTJOg9W5adSFTgZ3L1ADNWrNXotMti7seYk0A26aon5+1T+jgVH3X8A== X-Received: by 2002:a63:7f1a:: with SMTP id a26mr19199834pgd.252.1588130865211; Tue, 28 Apr 2020 20:27:45 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:44 -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 09/10] mm/migrate: replace PageHighMem() with open-code Date: Wed, 29 Apr 2020 12:26:42 +0900 Message-Id: <1588130803-20527-10-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> 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 Implementation of PageHighMem() will be changed in following patches. Before that, use open-code to avoid the side effect of implementation change on PageHighMem(). Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- include/linux/migrate.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 3e546cb..a9cfd8e 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -37,6 +37,7 @@ static inline struct page *new_page_nodemask(struct page *page, gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL; unsigned int order = 0; struct page *new_page = NULL; + int zidx; if (PageHuge(page)) return alloc_huge_page_nodemask(page_hstate(compound_head(page)), @@ -47,7 +48,8 @@ static inline struct page *new_page_nodemask(struct page *page, order = HPAGE_PMD_ORDER; } - if (PageHighMem(page) || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) + zidx = zone_idx(page_zone(page)); + if (is_highmem_idx(zidx) || zidx == ZONE_MOVABLE) gfp_mask |= __GFP_HIGHMEM; new_page = __alloc_pages_nodemask(gfp_mask, order, From patchwork Wed Apr 29 03:26:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11515963 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 1742092A for ; Wed, 29 Apr 2020 03:27:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE1122082E for ; Wed, 29 Apr 2020 03:27:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WfE/iAfJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE1122082E 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 F1FFE8E000F; Tue, 28 Apr 2020 23:27:51 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ECEF08E0001; Tue, 28 Apr 2020 23:27:51 -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 DE5148E000F; Tue, 28 Apr 2020 23:27:51 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id C3EE48E0001 for ; Tue, 28 Apr 2020 23:27:51 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 763845832 for ; Wed, 29 Apr 2020 03:27:51 +0000 (UTC) X-FDA: 76759458342.26.snail13_7ec5192c5bc4b X-Spam-Summary: 2,0,0,0537302360a39575,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2731:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6261:6653:6742:7576:7903:8957:9413:10004:11026:11473:11638:11658:11914:12043:12296:12297:12517:12519:12555:12679:12895:13069:13161:13229:13311:13357:14096:14181:14384:14394:14721:14819:21080:21444:21451:21627:21666:30054:30064:30070,0,RBL:209.85.216.65:@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:24,LUA_SUMMARY:none X-HE-Tag: snail13_7ec5192c5bc4b X-Filterd-Recvd-Size: 5428 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 03:27:51 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id mq3so218924pjb.1 for ; Tue, 28 Apr 2020 20:27:50 -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; bh=OoRI+cRunKH9WBjhUvLx6xEiTkTtLL8jDLPBXfzqLhY=; b=WfE/iAfJRj709WUE/DqCp3kQvZLDfPqz0Y+GFAuwA7l8LKNp0oWG35rkAoNlwpvZJ3 k4TnWr107Ixi9fhqz1qOaWTc50GGhV/Fx0Wsu3LTmy2DCVroGocU3ISWgKjr25sgMO0L t4OHwf3wKPVybUAboOEHTr9bObXq45dZjQ83L/voxeG8iKFVCFSfejvPKa7H/HtBB4dB mGAPVOBDNUSvC/SS1aLvmeYHQwMFXfancyfK0Q0lR2CzezZeTlrwqJjY0Gy7MWdiGyeg dUbpAxMCl55cyGRTrCHFbfjOtm9eBvlI9upgNDVsTJBQoAC9aqP7F9qcQ3QHtax4NECs Yecg== 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; bh=OoRI+cRunKH9WBjhUvLx6xEiTkTtLL8jDLPBXfzqLhY=; b=hr+wCJzUxb57BTGVs9CnEWFDs23dnnETuVIRCkQdLSg0eJc04wpvVrZGv9mKNAGKV6 xRGxJFV3rV+wR70bdcwH3w+0wHPYGED6gzXUUNa81v6F/MJmpTxIezOhL32RbtVEfhj3 xBzLPSrxjCZkCSK6IjNWGNxNimnU9ZSxpbCx6GIlbohJOyOCUXuaedyCh9A/6z17J234 1d3Y8t0TmG1+U9gccKkx7AOLA/KQULC6XItHtwx9l19DKmDMLkZhE6eySSNJKKazaVjr GIZYJoF0cha+t3vXsAbt/nCplfmA/ddAjt9U88Il9e4fEFIjxgW0Hl1Imxx1MV8ZtEn3 JoYw== X-Gm-Message-State: AGi0PuaQkLJxhJ392rzJ+WNDmI73Rkq7hpMamBirNYK035IWUrBHRH1V UoNFIEEld2AiesVMjRRMFNs= X-Google-Smtp-Source: APiQypJw1FCB1XxqXtN6Ir3II1PN4ozwDO72vOVsNUoYWwEuA3b0siqTDlaFqUHECfk4fYh3xh8fog== X-Received: by 2002:a17:90a:648d:: with SMTP id h13mr778148pjj.12.1588130870123; Tue, 28 Apr 2020 20:27:50 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id q11sm9559796pfl.97.2020.04.28.20.27.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2020 20:27:49 -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 10/10] mm/page-flags: change the implementation of the PageHighMem() Date: Wed, 29 Apr 2020 12:26:43 +0900 Message-Id: <1588130803-20527-11-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> 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. Previous patches introduce PageHighMemZone() macro and separates both cases strictly. So, now, PageHighMem() is used just for checking if there is a direct mapping for this page or not. In the following patchset, ZONE_MOVABLE which could be considered as the highmem type zone in some configuration could have both types of pages, direct mapped pages and unmapped pages. So, current implementation of PageHighMem() that checks the zone rather than checks the page in order to check if a direct mapping exists will be invalid. This patch prepares that case by implementing PageHighMem() with the max_low_pfn. Acked-by: Roman Gushchin Signed-off-by: Joonsoo Kim --- include/linux/page-flags.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index fca0cce..7ac5fc8 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -375,6 +375,8 @@ PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND) TESTCLEARFLAG(Readahead, reclaim, PF_NO_COMPOUND) #ifdef CONFIG_HIGHMEM +extern unsigned long max_low_pfn; + /* * Must use a macro here due to header dependency issues. page_zone() is not * available at this point. @@ -383,7 +385,7 @@ PAGEFLAG(Readahead, reclaim, PF_NO_COMPOUND) * in order to predict previous gfp_flags or to count something for system * memory management. */ -#define PageHighMem(__p) is_highmem_idx(page_zonenum(__p)) +#define PageHighMem(__p) (page_to_pfn(__p) >= max_low_pfn) #define PageHighMemZone(__p) is_highmem_idx(page_zonenum(__p)) #else PAGEFLAG_FALSE(HighMem)