From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757642AbcEDKiB (ORCPT ); Wed, 4 May 2016 06:38:01 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:54170 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757386AbcEDKh7 (ORCPT ); Wed, 4 May 2016 06:37:59 -0400 X-Mozilla-News-Host: news://gmane.comp.lib.uclibc.buildroot:119 To: Peter Zijlstra , Nicolas Pitre , Andrew Morton , David Hildenbrand , Thomas Petazzoni , Russell King CC: lkml , "linux-mm@kvack.org" , "linux-arch@vger.kernel.org" From: Vineet Gupta Subject: kmap_atomic and preemption Message-ID: <5729D0F4.9090907@synopsys.com> Date: Wed, 4 May 2016 16:07:40 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.12.197.158] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I was staring at some recent ARC highmem crashes and see that kmap_atomic() disables preemption even when page is in lowmem and call returns right away. This seems to be true for other arches as well. arch/arc/mm/highmem.c: void *kmap_atomic(struct page *page) { int idx, cpu_idx; unsigned long vaddr; preempt_disable(); pagefault_disable(); if (!PageHighMem(page)) return page_address(page); /* do the highmem foo ... */ .. } I would really like to implement a inline fastpath for !PageHighMem(page) case and do the highmem foo out-of-line. Is preemption disabling a requirement of kmap_atomic() callers independent of where page is or is it only needed when page is in highmem and can trigger page faults or TLB Misses between kmap_atomic() and kunmap_atomic and wants protection against reschedules etc. -Vineet