From patchwork Thu Oct 18 13:04:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10647129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E996B14E2 for ; Thu, 18 Oct 2018 13:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCBFD2887A for ; Thu, 18 Oct 2018 13:04:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0E82288B7; Thu, 18 Oct 2018 13:04:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BEC62887A for ; Thu, 18 Oct 2018 13:04:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C68EF6B0003; Thu, 18 Oct 2018 09:04:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C17816B0006; Thu, 18 Oct 2018 09:04:39 -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 B2ECD6B0007; Thu, 18 Oct 2018 09:04:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 74AE86B0003 for ; Thu, 18 Oct 2018 09:04:39 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id 87-v6so29306763pfq.8 for ; Thu, 18 Oct 2018 06:04:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=Q7pLO/7GAzt114u+PKiT1kCr+kfGYlrrzPGtOm1aV7c=; b=hiVicF/MDCBmfGIMOqY3On8dzKvTAdix8D/+/TPHtk419kxFgQa1wJ59G3OIVXUGRT JknGXILWqsjuYMmUE+HA4iEYJUBUG6Hi7fsp0PF50sGoIspo8IMBq0YaEM16IXDoBfmp H4ALmkygT4MlVqyjdzsRMsp2esHUIkgvydO/3SwPCeOXy6+LtVW9dyLlSoN+8l9R+sS1 EnzQ0GPy5hxAnC0JZmZ+osakdX95qaJSXkm26D86/B8gWQIIEMePhCfhvrM+uXOBrtul lpv7V20DLAunX35Y8dYVtI+2Lm4GOSXKRQyagT8KYhgaidCOy40tl2AfCbK7pSl4z5iD Pn9w== X-Gm-Message-State: ABuFfojNwmTj+4im90DQhPiPDV0pIATj+4S1cjYOWod2/ebJQXOlzj2h ZLXTdyFdmXA0Gzn2pWPLA6L1B5ZB6yYGObBToD6fp2GFvx6Va/5wmAEiq1jeQnDvYMVzKcQ+H9y U/bpymYrBWzjAtL/DrkcjR+ybNJC+Cab5DgkQkKb9XXDwaHTjw+NajL3/GDuuEQaTgJMjGs7VrZ cnN66fBaGarQ9mjZveAoYgHkeZ1BvgtWzr+0PI/IKutbjOw7q1WnDj/+J9AT26ACshyF4nR5BUV QHNTlcMwqkyyXozHl+7kFD1HIyk82Q+kxu2ymeIVu2iqZ+EaFawQR+bPOcigL0y91JVeMdBJbyM YFVWb9TNuRHfdk1SYSuyFQxkH4NdADHUg4/9hwY/L41W8iZOer0u0H7kNKaHjmEGMwWDJReo6I1 W X-Received: by 2002:a63:2323:: with SMTP id j35-v6mr28699073pgj.337.1539867879162; Thu, 18 Oct 2018 06:04:39 -0700 (PDT) X-Received: by 2002:a63:2323:: with SMTP id j35-v6mr28699014pgj.337.1539867878340; Thu, 18 Oct 2018 06:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539867878; cv=none; d=google.com; s=arc-20160816; b=MPTYy1L99rRatXiaMY++GVSfRKImKVt+AJBUtq+c+VixpOvcYE0ohL9YI7lyFoIXb3 LSy37hTuc1S6z1uyxiBs6WRgQ7gQXD3d7B5VT3fTL97NCJxvv6Tc1Al7e9w3KJjhQRwx pSD0u3l3z/Fb0T8jFp88PaL/ZYnS0ZvJus47QlM4UxizST+VNAT9PjCEpasNoKIcoMLo 3fDRWJkZHj1EtG0xUaDoorY/j96Gj2rToTcwR3yI9uVIZ0SFAmiTrfdPGrpMK3YFpzen JeZpmsq8PH+67soL9Rb36S3e/5aCrmO5LIhyKvXZSe7cQprx9Zuy+o0YrOvGTGxuzOCn 9G2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=Q7pLO/7GAzt114u+PKiT1kCr+kfGYlrrzPGtOm1aV7c=; b=uhUxa3i33fOVG1OrxGA9EqkdgpGTfB50/PJvxo/al6kqL2vHtvv4lBPsiOehx+DRlI 9FN6aaMJ/TK5n0iLmMU+5pDSLV6nZCtfje6G6p+ZGabxtllYMMciS2mgH03ILdE/MacU gemoyGmDYz7hazC4710i7uscjbcdM7FUCYELthdhZlhj1k6tfX7DdKt8xVmU69l5cLEg lo7cCx+/U8JuTUrZQOQCvC5STrQVM0NVdcPnFsCAXOEwljpfYHEB/ZPwBllSdUWcnKaI 5lrDndXQSVl7YJWnkWbCAweQwziUaSHpEy2y2Y6GihlVVtBrm6OwW5EfTftBV6VShHAz RcLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nhz+8sYJ; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f1-v6sor580207pgv.58.2018.10.18.06.04.38 for (Google Transport Security); Thu, 18 Oct 2018 06:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nhz+8sYJ; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Q7pLO/7GAzt114u+PKiT1kCr+kfGYlrrzPGtOm1aV7c=; b=Nhz+8sYJb+aybZmbpZc/1btdpUYTrsZBryOLbemRH4TGf+AYXqdo1+IBjUbxlU/Sxi g/TeQtRelUxfKf9R2FYo3UdFzSbSZ2j0YSPHtT1G+hke0YPg4um6rUMCu108Yy4gR6wu oPHGbGspxt9A7b5fXbhZVK7cPJ91mr4K0HpZJVqaAD2zaqzJJevbLHHcf0Gc9BXMoPQY JeA4Rs4bz21H6jxAgj7n/n1gNzQpfN6lvPpynETKkG6Ans436XtKK8NhknF4jpvq709b 0w/y551v5v6ilLfmNXg/SKw2Fp70sH0sMURh1AGLO6gh26x9GBFOPEsP1iSx2laTILxS TeDA== X-Google-Smtp-Source: ACcGV6283Lm4OBhi0YpDEW0v0nJiZCBIWSMdJ00t6Um+8J6wG2PNMJxL1pmfhx8EAckS5uR+OcEDOA== X-Received: by 2002:a63:345:: with SMTP id 66-v6mr5602242pgd.113.1539867877588; Thu, 18 Oct 2018 06:04:37 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id m7-v6sm21144662pgq.59.2018.10.18.06.04.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 06:04:36 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, mhocko@suse.com, mgorman@techsingularity.net Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH] mm: get pfn by page_to_pfn() instead of save in page->private Date: Thu, 18 Oct 2018 21:04:29 +0800 Message-Id: <20181018130429.37837-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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: X-Virus-Scanned: ClamAV using ClamSMTP This is not necessary to save the pfn to page->private. The pfn could be retrieved by page_to_pfn() directly. Signed-off-by: Wei Yang --- Maybe I missed some critical reason to save pfn to private. Thanks in advance if someone could reveal the special reason. --- mm/page_alloc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 15ea511fb41c..a398eafbae46 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2793,24 +2793,19 @@ void free_unref_page(struct page *page) void free_unref_page_list(struct list_head *list) { struct page *page, *next; - unsigned long flags, pfn; + unsigned long flags; int batch_count = 0; /* Prepare pages for freeing */ - list_for_each_entry_safe(page, next, list, lru) { - pfn = page_to_pfn(page); - if (!free_unref_page_prepare(page, pfn)) + list_for_each_entry_safe(page, next, list, lru) + if (!free_unref_page_prepare(page, page_to_pfn(page))) list_del(&page->lru); - set_page_private(page, pfn); - } local_irq_save(flags); list_for_each_entry_safe(page, next, list, lru) { - unsigned long pfn = page_private(page); - set_page_private(page, 0); trace_mm_page_free_batched(page); - free_unref_page_commit(page, pfn); + free_unref_page_commit(page, page_to_pfn(page)); /* * Guard against excessive IRQ disabled times when we get