From patchwork Fri Mar 6 09:36:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenqiwu X-Patchwork-Id: 11423433 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 2D4511395 for ; Fri, 6 Mar 2020 09:37:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E3F49207FD for ; Fri, 6 Mar 2020 09:37:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L3SbijTF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3F49207FD 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 2E7CF6B0005; Fri, 6 Mar 2020 04:37:03 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 271556B0006; Fri, 6 Mar 2020 04:37:03 -0500 (EST) 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 139306B0007; Fri, 6 Mar 2020 04:37:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id EB8346B0005 for ; Fri, 6 Mar 2020 04:37:02 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BF7D38248047 for ; Fri, 6 Mar 2020 09:37:02 +0000 (UTC) X-FDA: 76564433484.16.talk29_3d7b464b42630 X-Spam-Summary: 2,0,0,74b68c65496ac045,d41d8cd98f00b204,qiwuchen55@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3866:4321:5007:6114:6261:6642:6653:7576:9036:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12679:12895:12986:13069:13311:13357:14096:14181:14384:14394:14721:21080:21444:21451:21627:21666:21990:30012:30054,0,RBL:209.85.210.195:@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:29,LUA_SUMMARY:none X-HE-Tag: talk29_3d7b464b42630 X-Filterd-Recvd-Size: 3538 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Mar 2020 09:37:02 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id i13so851066pfe.3 for ; Fri, 06 Mar 2020 01:37:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9ucy8SPvTRGETDtkn8P9daO4OKwm65xP9fpvcE44QLc=; b=L3SbijTFZcrvl7vpxqqb2PyLoI/BraoHkLQ0Ik0SyVZzYJ3koE5KFggR9eab6dSFuv xdLu3kdAeN3kbvjW3GH/L8YiswBiDpYH8Uv1xXomp1EQ+navhiAiPWkTnjwZqaGFGCW9 wHWQzfZy1Jq9PwlDBd+/HVlMvWu/32GiJxd3dUy0TLozAursX3e/wbCX3M5rFo+6VVW6 LD0tlmR9hkrmTvJldnDHD2vao4b0CtAAEz0rlHJmbcVZEOPxetc/Xf/iawLOmDH6BCou vCK0ehdfqJnjDA2++1L+v2VObKa/kKA38doPn4VwCX1EopeMBPgcEE9comYEezQ+f3St lOhQ== 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; bh=9ucy8SPvTRGETDtkn8P9daO4OKwm65xP9fpvcE44QLc=; b=tkJtNWwEvANK0nEJgKTCdWQmWPap1AHn9iZO8lvpmz6Q0NpVKp4Aq0Ums0BfssmEIa s3jS8uSCEC8UM49733TB9rGfPvHy253cq53WC/3mIwo0WyiG1MAWZyNdojLrWn7vzfZC rdwtvvGbeJzr1ZPqgRfp6wF9JmrPjH7uxl30o4BqkuloXCMcFtnAWR00SOwb3HZzHsHz Zr95uSotUQhH/euDKhXXZa+el5qEc6L9k4HpS+Z/YK788b85ihHTty5zRgOJzoe2LU+Q u1wn0PYSH8/bTtuiFvJpXGgzlVaMWki+IYki4AUeifp8ZZbbnM/dOhRFQ2YQEQJgQ7vZ Md2A== X-Gm-Message-State: ANhLgQ2A+SVG73dwdNutvgRo6bz/SWJ9py6zFJt9c78qFyYLYzQgkINI 7r98IEUG0KnR8dpjO90uLFQ= X-Google-Smtp-Source: ADFU+vsaW0yh0ndBmfm2ssFYlCoLXU7NRUGYFLROHK2bm024HCU8natwJ4IDJzGos7nFeJycWKhdyA== X-Received: by 2002:a62:154d:: with SMTP id 74mr2981584pfv.92.1583487421184; Fri, 06 Mar 2020 01:37:01 -0800 (PST) Received: from localhost ([43.224.245.179]) by smtp.gmail.com with ESMTPSA id k3sm34315921pgh.34.2020.03.06.01.36.59 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 06 Mar 2020 01:37:00 -0800 (PST) From: qiwuchen55@gmail.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, chenqiwu Subject: [PATCH] mm/sparsemem: use wrapped macros instead of open-coding Date: Fri, 6 Mar 2020 17:36:56 +0800 Message-Id: <1583487416-15954-1-git-send-email-qiwuchen55@gmail.com> X-Mailer: git-send-email 1.9.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000010, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: chenqiwu Use wrapped macros instead of open-coding for better code readability. Signed-off-by: chenqiwu --- mm/sparse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 42c18a3..73e1038 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -385,8 +385,8 @@ static void __init check_usemap_section_nr(int nid, old_pgdat_snr = NR_MEM_SECTIONS; } - usemap_snr = pfn_to_section_nr(__pa(usage) >> PAGE_SHIFT); - pgdat_snr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); + usemap_snr = pfn_to_section_nr(virt_to_pfn(usemap)); + pgdat_snr = pfn_to_section_nr(virt_to_pfn(pgdat)); if (usemap_snr == pgdat_snr) return; @@ -677,7 +677,7 @@ struct page * __meminit populate_section_memmap(unsigned long pfn, return NULL; got_map_page: - ret = (struct page *)pfn_to_kaddr(page_to_pfn(page)); + ret = (struct page *)page_to_virt(page); got_map_ptr: return ret;