Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp84107rwd; Fri, 26 May 2023 15:26:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56PQVzzqd/lY9awYyW+72FthGJuJBRMIjDbH6jjBlS+CM4/znmIUAXDWTW3u7BeRXGSZkP X-Received: by 2002:a17:90b:4b47:b0:256:4b9d:8a42 with SMTP id mi7-20020a17090b4b4700b002564b9d8a42mr115376pjb.48.1685139990208; Fri, 26 May 2023 15:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685139990; cv=none; d=google.com; s=arc-20160816; b=ZyNs0nQ1Hi6HyBfQemD/xFHSdmpSOXskgtBEdnP36xX1Z2Je75tVGSZQ8ieoYD89Vr Fxzz4s8f6qyfYpT/cYMCIY+BU1SD02KNZWG27t8/Wfo0Qr9cquHLmALaXJ2u3QtGyiLT dLGeYm0CGCX4pXx5ZDoscbYljO8mrVYBDu9IAAvanIax388dFiw6lqLbvUFG9m1Db4Ep BBHTTEPQduHfd2Ozv9eVyGpb1jSkoK/iWEBJOrj5EaDtwItG9Gj4ijaOwSKQ4ITr4iy7 SRx1ko1GIgWczTOI1z7o56hgrBQZGp2Wn8XKFqeUcUOLk0haHgLaPOceA9UpSqXqnYgU nwEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sdSWc76ZFLkjK5DbgpWrJvf7OomkiaCs2j7NqqLWdDc=; b=BpNkx+G0r640gm7Nd0CRlzxH0wfJpLf8UaDBA/sXEnoTJmr33vvWN00HvxkdI4LYaN sHLyb8Bs0gxB5KS77dMuKjwq6EOIYRV8eml1csmSU6UV0MPBgAJDXRwcs23pjGO19Px4 xBP64SvYWqYusqNyId9UMbsD3/2gg1u0ZayRm4P9+Km8h2RkMF/Om/QM4Rts6fuCoc9z s4aY7QGHH89ixFmdVdlQsh1iUKgMEIhtKv5TIacoOlza80117JYFOjqP8VxQfQhYPZQS DghEuk0P/glT/1Spk6b4lGObLKtsl3HRQGTl2+arMN/5KnHyPdNBKouwxcgpjebybHJp 5ubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wwip9dfL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls8-20020a17090b350800b0024f338cd9f6si4235376pjb.130.2023.05.26.15.26.14; Fri, 26 May 2023 15:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wwip9dfL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237823AbjEZWYD (ORCPT + 99 others); Fri, 26 May 2023 18:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbjEZWYB (ORCPT ); Fri, 26 May 2023 18:24:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B0E10CB for ; Fri, 26 May 2023 15:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685139790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sdSWc76ZFLkjK5DbgpWrJvf7OomkiaCs2j7NqqLWdDc=; b=Wwip9dfLcsMGyfuU9A0d0TDnZWuRRKUMAxPlk2+m0n7icoCin0Odd+CWhNXsNV2pAVLYU0 4xAXOYno/uGhT4Pi03wDbdvKzX43I7udwPxEnED4zLCS0nrRASmM+ilNzhtTaDT5AZI0HN GhL/eiKVcaZ+nIcOWXujdwSbkXK/ogI= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-626-qB3GjLWuNSeMNzxDfzlUAA-1; Fri, 26 May 2023 18:23:01 -0400 X-MC-Unique: qB3GjLWuNSeMNzxDfzlUAA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-625891d5ad5so2867136d6.0 for ; Fri, 26 May 2023 15:23:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685139781; x=1687731781; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sdSWc76ZFLkjK5DbgpWrJvf7OomkiaCs2j7NqqLWdDc=; b=cvDlltmr5Of9dZcd6kPAs07pstuYXq5nj8PIxuoOkY09hzCNRFnmpVgOd7VFyi4a62 RIpZ912uWe443pjW/jUeXc92+QbDmAjsN7kC+Uak+gi3ZmAnKElAtg4tLxTwkV9DJ1Gi JKOW6Ejp2SVFMf5SLoZw26EvPJ5NCewKWn3RJuxmDF2Bw0faRtYqrpo24d/gl+GXC1zM U2ABCxqGPQzgRSdTPVPnW0KqESqGnhk1P5HA3CrAWsZQUJiBrc+LGtDBibRY9TBhJ+cu fu1Xve5mEBSGv0bxhb73zsIT/gzVgfvM5GCawkQD81H0aNRti+d8zeKZ2sgoM5ZHW9FH /5rA== X-Gm-Message-State: AC+VfDxqJXA6kMDmoBtEE+HqvWFa10/3ciqRSd574isKV8r4zxPIxwHL c55sPiUrNORd2rwyhlLZE6sNz4dctSpeWv/qBAgoLJ5bQcYKmCfibXHi/Kp5jEiZv3w80SpzHIb +sRqbxuiUKEIT1Oyd74Y1N1q3 X-Received: by 2002:a05:620a:268f:b0:75b:23a1:69e2 with SMTP id c15-20020a05620a268f00b0075b23a169e2mr3017440qkp.2.1685139781028; Fri, 26 May 2023 15:23:01 -0700 (PDT) X-Received: by 2002:a05:620a:268f:b0:75b:23a1:69e2 with SMTP id c15-20020a05620a268f00b0075b23a169e2mr3017424qkp.2.1685139780779; Fri, 26 May 2023 15:23:00 -0700 (PDT) Received: from x1n (bras-base-aurron9127w-grc-62-70-24-86-62.dsl.bell.ca. [70.24.86.62]) by smtp.gmail.com with ESMTPSA id a13-20020a05620a124d00b0075936b3026fsm1480280qkl.38.2023.05.26.15.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 15:23:00 -0700 (PDT) Date: Fri, 26 May 2023 18:22:58 -0400 From: Peter Xu To: Hugh Dickins Cc: Andrew Morton , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 03/31] mm/pgtable: kmap_local_page() instead of kmap_atomic() Message-ID: References: <68a97fbe-5c1e-7ac6-72c-7b9c6290b370@google.com> <9df4aba7-fd2f-2da3-1543-fc6b4b42f5b9@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9df4aba7-fd2f-2da3-1543-fc6b4b42f5b9@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 21, 2023 at 09:52:31PM -0700, Hugh Dickins wrote: > pte_offset_map() was still using kmap_atomic(): update it to the > preferred kmap_local_page() before making further changes there, in case > we need this as a bisection point; but I doubt it can cause any trouble. > > Signed-off-by: Hugh Dickins > --- > include/linux/pgtable.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > index 8ec27fe69dc8..94235ff2706e 100644 > --- a/include/linux/pgtable.h > +++ b/include/linux/pgtable.h > @@ -96,9 +96,9 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address) > > #if defined(CONFIG_HIGHPTE) > #define pte_offset_map(dir, address) \ > - ((pte_t *)kmap_atomic(pmd_page(*(dir))) + \ > + ((pte_t *)kmap_local_page(pmd_page(*(dir))) + \ > pte_index((address))) > -#define pte_unmap(pte) kunmap_atomic((pte)) > +#define pte_unmap(pte) kunmap_local((pte)) > #else > #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) > #define pte_unmap(pte) ((void)(pte)) /* NOP */ (I think this could be a dumb question if this patch has been running there for years downstream, but still..) I assume one major difference of using kmap_local() is page fault will not be disabled, while kmap_atomic() will. Meanwhile, pte_offset_map() is also used by pte_offset_map_lock(), which means before this patch CONFIG_HIGHPTE systems will disable pgfault before taking pgtable lock for it, while it will stop doing so after the change. Then what happens if a page fault happens on the same pgtable lock range that is already taken by the thread context? What stops the deadlock from happening? Thanks, -- Peter Xu