From patchwork Mon Oct 12 06:00:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 7372291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C88BE9F1D5 for ; Mon, 12 Oct 2015 06:03:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED811206D7 for ; Mon, 12 Oct 2015 06:03:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC7B02069A for ; Mon, 12 Oct 2015 06:03:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZlWAX-0006sf-Iq; Mon, 12 Oct 2015 06:01:09 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZlWAV-0006oU-8B for linux-arm-kernel@lists.infradead.org; Mon, 12 Oct 2015 06:01:07 +0000 Received: by pabve7 with SMTP id ve7so86790173pab.2 for ; Sun, 11 Oct 2015 23:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yKrWbIWdR7rY1VuErMBnYvCmUfKDG0+NKuubriVbcQ0=; b=t4EbRNix2lubym0pzo13EHgrmZ4CnA5FphwZzyXYOOMU3tiHJbNT9eOP/qDGS8brsM xwhD4bgIJVtaZaV2PO8ZbamiHGfP3NtJz7aDlvjo0R2tBHpZVsmcBv6QEb6sofa8Gsb9 fjo47WuPp+d2ntHYKfmM500TUDo5LgETLakoJdS2QHshH2x9qNS2scswOuB8Ag3ZIrKi 9KZw+lDgWqsJg/JoEKhiu6oeWKvF2OrxSFfD3tp9rMP/GjgcuFq2TB3J3i/UUgbqckrU +Z9trNBhi4Dnl3usk2OZyqKfCZ2UmYb3vmERK/6dk8IBmxqrEZqYWy8++WoyzwQShs2F Igxg== X-Received: by 10.66.146.69 with SMTP id ta5mr32966814pab.46.1444629646461; Sun, 11 Oct 2015 23:00:46 -0700 (PDT) Received: from [17.87.20.169] ([17.87.20.169]) by smtp.gmail.com with ESMTPSA id tp6sm15834060pbc.81.2015.10.11.23.00.43 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 11 Oct 2015 23:00:46 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) Subject: Re: [PATCH] ARM:mm: fix kmap_atomic_to_page From: yalin wang In-Reply-To: <1444129773-12632-1-git-send-email-chanho.min@lge.com> Date: Mon, 12 Oct 2015 14:00:38 +0800 Message-Id: <3B252F19-0EE2-4CE3-81B5-E8BED7212A2D@gmail.com> References: <1444129773-12632-1-git-send-email-chanho.min@lge.com> To: Chanho Min X-Mailer: Apple Mail (2.3094) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151011_230107_324795_E0D6A51A X-CRM114-Status: GOOD ( 16.93 ) X-Spam-Score: -2.5 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jongsung Kim , Russell King , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Gunho Lee Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > On Oct 6, 2015, at 19:09, Chanho Min wrote: > > Since kmap_atomic returns the pkmap address without a new mapping to > fixmap for the page that is already mapped by kmap, It should be > considered for the pkmap address in kmap_atomic_to_page. > > Signed-off-by: Chanho Min > --- > arch/arm/mm/highmem.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c > index 45aeaac..3e973b7 100644- > --- a/arch/arm/mm/highmem.c > +++ b/arch/arm/mm/highmem.c > @@ -145,8 +145,13 @@ struct page *kmap_atomic_to_page(const void *ptr) > { > unsigned long vaddr = (unsigned long)ptr; > > - if (vaddr < FIXADDR_START) > - return virt_to_page(ptr); > + if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) { > + int i = PKMAP_NR(vaddr); > + return pte_page(pkmap_page_table[i]); > + } > + > + if (vaddr >= FIXADDR_START) > + return pte_page(get_fixmap_pte(vaddr)); > > - return pte_page(get_fixmap_pte(vaddr)); > + return virt_to_page(ptr); > } > -- > 1.7.9.5 > why not change like this, more simple : Thanks diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 9df5f09..4eeed3d 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c @@ -152,8 +152,7 @@ struct page *kmap_atomic_to_page(const void *ptr) { unsigned long vaddr = (unsigned long)ptr; - if (vaddr < FIXADDR_START) - return virt_to_page(ptr); - - return pte_page(get_fixmap_pte(vaddr)); + if (vaddr >= FIXADDR_START && vaddr <= FIXADDR_TOP) + return pte_page(get_fixmap_pte(vaddr)); + return kmap_to_page(ptr); }