Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5983846ybi; Wed, 29 May 2019 00:38:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0StoOIjrS1oPa8S9qRV3HHwXs8O0MIO/vkhlFZ7EoWY/akJ8412nQbd1pgW30lH8rtVoh X-Received: by 2002:a17:902:2983:: with SMTP id h3mr113322036plb.267.1559115535009; Wed, 29 May 2019 00:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559115535; cv=none; d=google.com; s=arc-20160816; b=Cm/VNF8yVhvgeU988ErelQ9yqi9HBQbraSBZftmGXx+5hDH4er3lFthlo0rc6kUrAD DqF1arO+fju1pDRe735Tcm4RHTNa4zY0pA5CV56L2wtQUe/5EPM67XtKQYwz881TYV90 RWCGvNyZvGpbXeHZE7Hr6U9/Q4HmzowFEUBosnbMpY5HkRg1bPabzVTxkfX9LEHFAcjD docZFd04tjyltd+cDbB0ItwWYsUrDH+Vuf57l0LBFWo9bZsnRtiDbbdbBoR4FTlRnYq1 jMdEeZMHSqGv6zWvst+Yzr5A8WPRTfmOhnb2jV3A0LdyS3335j7F79O95fsXzyL6n7QA eM2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:cc:to:organization:from:dkim-signature; bh=xO/I95wa/BDchQFoLjVha8GkTVVJiQMKwy7fu/wkxYA=; b=00m4/oPkpYUMxseLH4MpOT0WnlfzlQ6uaIDyQyED9kzmmIRq+RQqIijyjGsBuM5bzf C/h74d7SNcsSFPFGCFly4GcGjYjdjgNZBRC7jV4aXQtAHTfY0F6kr9hlZArcDhCj9h6e pBo0Ob77eeoY18+aO2LrZzY/Pr4m4g4lciS69guL1mvCyK1IvMoYA9NiDgJKqmz1dJh0 nZy5SxNTejtZGT8TWi/lVOrFcnCnEoKVtu3eufsMdT3jgJCR9iMbjKtp+/jG+m/y2CY3 P9rEOUe087zUtWnyb2fHXFF3J2kybKuB0yXfHaNxlwtUAkcPx0mAVvRWDaPyNh1rUVc6 E8yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=P5KPPLS2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si22910423pgr.22.2019.05.29.00.38.39; Wed, 29 May 2019 00:38:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=P5KPPLS2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726813AbfE2Hge (ORCPT + 99 others); Wed, 29 May 2019 03:36:34 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:49044 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfE2Hge (ORCPT ); Wed, 29 May 2019 03:36:34 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4T4s9jf141872; Wed, 29 May 2019 04:55:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : message-id : date : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=xO/I95wa/BDchQFoLjVha8GkTVVJiQMKwy7fu/wkxYA=; b=P5KPPLS2UzjMJn6rGUCVjhYHj8LaJwoGOxhnoVHzWY+CmNEcnqmounAsekASPzNLBOro MaXZltz3kUZk/zCQoeyPB6vOfizOZyGpKOj9ez31MiimJ1LBuinzD1XDAvZO21j4ddeD vm3qPI94Hu3mANEt5VILtTSbGR+kD4wLVvmAqIpp4ieESvWfzO9biPI3ZS2hR0gIIvgZ eJohCUeOWnwh7B8mQ+eXwqSkc+KCKqD8lFE71DecQ3wpEziD05jDCH5HCGZDPcmSAGtl MAzisqiEfgOq0kKmC935/NBp4Z4gUgmAp4O8dCVHDw8x1zZw2N5BhYKW/qnTnpuk3XKN ow== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 2spu7dfc6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2019 04:55:07 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4T4sHBi124365; Wed, 29 May 2019 04:55:06 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2sr31v1hy8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2019 04:55:06 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4T4t5v9001280; Wed, 29 May 2019 04:55:05 GMT Received: from [192.168.0.139] (/118.26.137.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 28 May 2019 21:55:05 -0700 From: Zhenzhong Duan Organization: Oracle Corporation To: LKML Cc: riel@surriel.com Subject: question on lazy tlb flush Message-ID: Date: Wed, 29 May 2019 12:54:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9271 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905290032 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9271 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905290032 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maintainers, A question raised when I learned below code.  Appreciate any help me understand the code. void native_flush_tlb_others(const struct cpumask *cpumask,                              const struct flush_tlb_info *info) { ...         /*          * If no page tables were freed, we can skip sending IPIs to          * CPUs in lazy TLB mode. They will flush the CPU themselves          * at the next context switch.          *          * However, if page tables are getting freed, we need to send the          * IPI everywhere, to prevent CPUs in lazy TLB mode from tripping          * up on the new contents of what used to be page tables, while          * doing a speculative memory access.          */         if (info->freed_tables)                 smp_call_function_many(cpumask, flush_tlb_func_remote,                                (void *)info, 1);         else                 on_each_cpu_cond_mask(tlb_is_not_lazy, flush_tlb_func_remote,                                 (void *)info, 1, GFP_ATOMIC, cpumask); } I just didn't understand how a kernel thread could trip up on the new contents of what used to be page tables. I presume the freed page tables are user mapping? But kernel thread only access kernel address space, is kernel space also freed? thanks Zhenzhong