Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3364954ybz; Mon, 20 Apr 2020 01:02:10 -0700 (PDT) X-Google-Smtp-Source: APiQypIjMzxg3DlLTwX93/m6tQZw1jCNam8fKUe7hSz1in3hHBGiG188ubYUqc7+kxdyjdOgqLRB X-Received: by 2002:a05:6402:1506:: with SMTP id f6mr13071984edw.217.1587369730540; Mon, 20 Apr 2020 01:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587369730; cv=none; d=google.com; s=arc-20160816; b=lQ1T/t/KCIBzMJNlStFHrOWHiHDHyO98za6JOvqHlBnZf8dTxufxPxpjHKEQn2kjyV 2PBmLnz/YI5HEWQ9CJiTyNC9Ltd7dUwfiWNTWxsB1F+i11RNgktVwkQMtkdqU8is9iyj 4oO7VloyEnZ6oMdsiEqhCDU0jTsIrQq3fw40aAf1hCQm/8/M8Jg2RcRof27Pw1xnOzao rXrC0u5NRJ2/zoxfsObdyL6FB42g16E08N1UGC7+vw0ZnpzCzQn/VRmqrO1eff+Rur1j mucRKrVX+i1tzyQlI5zxH7IrRbQrIl3AMKeo88gCPspK/T5MuwgqFQ4SFhLEV5Rnonzw Rucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=rG1v9CPi234T/7BGeZb8RVyl19HAO0cKxry9IQFPdUs=; b=xjSXZae5dgyYRYtomHe6WWXoTlaaHagg8mrkD9iBlWL8tMCZSlbPQWPIB5R0tZFLw4 S1UcMMLUOv6kJG6LSVHVIc+v23bwoX6m9caAiGwEL6JsDT/CzSgz+Vp01f9S4DLarR9U xqoYoey4Nfl7/vSR9tlG0zkSRVNjE+VNDic1QFt3+vCxYOPskm/tg0NmYaMf0ShLwFQ1 sMRF319petaogFHrhXxOmKqaQ6gz1IlFYXHiaabNnh+8ZIX/u4x3Evbs4rTkxGF6P93Q 8vNS1xFMD1pv44Mwm5BVdHLHvPZo3ij0mNaLINS84ruj6lkSuriWKYbWjclVdXRvnnVT U1pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QrYUGa62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by26si98127edb.144.2020.04.20.01.01.48; Mon, 20 Apr 2020 01:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QrYUGa62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbgDTIAh (ORCPT + 99 others); Mon, 20 Apr 2020 04:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgDTIAg (ORCPT ); Mon, 20 Apr 2020 04:00:36 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4A0C061A0C for ; Mon, 20 Apr 2020 01:00:35 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id w11so4651663pga.12 for ; Mon, 20 Apr 2020 01:00: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=rG1v9CPi234T/7BGeZb8RVyl19HAO0cKxry9IQFPdUs=; b=QrYUGa62xNb+TlIH1Ydgi8sqW1zW5PgqK+OvOJOOgheXl7GlMmDZu+yfifjtb3p5GB l6lUv0b9WvzRpP+yRoXShKmYi28dTgVGJqPpFZt0RHoz73aUydDbpQKbaHNyBtUT9q3F 4EdzwxI2K4oGwm/6xlBnnAoA9w8/w88awsCajgD8spSp2VWbU6A9tAWkOldCm2uwsexf HIdfeEhsTiUqKrWyPFPrtRoWILZIvMXnkblNVF8A9pQqqopN6FlnuKD70PeAp0Zgjxyo pDbrvqkATfb5NYUlmlX/6s/LwNJ8Y5xRt+3rbDOOqbB119QeGQSYzGnziYsSAtZHzrw/ 5bqA== 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=rG1v9CPi234T/7BGeZb8RVyl19HAO0cKxry9IQFPdUs=; b=tWZeS2J+36BDXjo0pORM1DD6R+Tb9vskq+HTSbiT1xTZhKE+eBw3DYsNob1GlCes0A 7S1R5gGcJchD71J0cjq2MUnpsbD3mVh4dxBX7qnjtm5K9SyIZPYFKUomRxrBrZK6iKIW +zNuyvdQ0Fiy0jRK2jMJ+V2daIV5+ngPdQTLhQRCo1TvVYOMznz4V7qWxo04T6AR310t d/z9bwRJsAPqzmfJOeT4/DgVoGMVr+pxNcTV515cMVrBjdPeoHrrT092obJFRrvsNceM F3yF9VAoIYvMr8SUvFpTQ2osqZ+OyG1iyuRWsDz3pTxHvU6tqXZ0Qd0XjunNZuI7KkdQ mMig== X-Gm-Message-State: AGi0PuaMSbzsEh2GVtfR03ZjhWuiTvY80ZcITTW0Xe99Bxsxz2l7fGBZ XU6HSdl1TEocaVhIIFjvtkg= X-Received: by 2002:a63:3502:: with SMTP id c2mr4187544pga.276.1587369635436; Mon, 20 Apr 2020 01:00:35 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id n9sm314947pjt.29.2020.04.20.01.00.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2020 01:00:35 -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 , Joonsoo Kim Subject: [PATCH 02/10] drm/ttm: separate PageHighMem() and PageHighMemZone() use case Date: Mon, 20 Apr 2020 16:59:34 +0900 Message-Id: <1587369582-3882-3-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587369582-3882-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1587369582-3882-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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) { -- 2.7.4