Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp260028ybb; Fri, 27 Mar 2020 21:32:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvpFPQMIan5AxjmlTkAEWk3BBy4Kv/5tDHmxO/u/SlaFrsi8+m4nRkRWEIpqhiuTeNBVZLP X-Received: by 2002:a9d:3a62:: with SMTP id j89mr1413021otc.45.1585369967405; Fri, 27 Mar 2020 21:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585369967; cv=none; d=google.com; s=arc-20160816; b=ozAp23f+SScPloPg0NQunbkNOu6HZsTHIPYUHqhYHN7R+fo/yOpEamOhyG67SsiZr1 5spf+jNLfZux7Zj+QS01ZrAmuKdoMUDX93mukw02mF50TrANY0DIpgDQzWm+68TnOR1t sOtXAaDOeQaOABxUq3FyT/VDfqequeOBNm9t2e3EkHyK3NahZUxci9ClOIjsxZ68FfhJ Hk6jx3Xkf2RA2WntkCRl6SoBny9Sfbx+/jfN+yUkVs2ccd8hIdD+JPyUrA9Pe3uQVy9p dt2FooSLMI3Ey2qPnXCG+Zb9wLjjX3rwJ/MRopF0Zujq0ydWQXiYQLw7S/iFuyWaZRe9 SyrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:date:message-id:subject:cc:to:from; bh=R8jRqNsVHAAm3SLEpLTeaktgpXiuiVs0FB6gAr1eeJA=; b=yVAU79Q5aAG6eCnpH7opz3imgcAOasf9Ark/99crK+bsvvy+dJyAPtAGyV/z5G+zE7 gHwBiEOsz+7GBeS8Pxyw4RFoZd3S+qNKCi0mEaLv0lKSk/AoBOMrK/KrQTcrglajoMb6 dFaB7J7mD0Pe/UfkSqhqRB9dPKHMrim3RSV2iJvLL4tJfof1wZRZWim8yBHnahUWxORh ivkdXG8P0ZFCBiYisSJ3BsuTfSMN9TDxl26kZec7Tb0shIgOGwz4SK84RclKVmhnl45r hi4z0XWZoUgyWKopLBrcYYw2VN/o1nQ9Bf2Ve2LyOXkYLCgeo8yPQCNDHoMIsorFByn0 rLDg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z65si3217583otb.197.2020.03.27.21.32.22; Fri, 27 Mar 2020 21:32:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725999AbgC1EbE (ORCPT + 99 others); Sat, 28 Mar 2020 00:31:04 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12209 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725372AbgC1EbE (ORCPT ); Sat, 28 Mar 2020 00:31:04 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7A61A296AB1C88EDC8D1; Sat, 28 Mar 2020 12:30:59 +0800 (CST) Received: from [127.0.0.1] (10.173.220.25) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sat, 28 Mar 2020 12:30:52 +0800 From: Zhenyu Ye To: Peter Zijlstra , , , , , , , , , Marc Zyngier CC: , , , , , Subject: [RFC][Qusetion] the value of cleared_(ptes|pmds|puds|p4ds) in struct mmu_gather Message-ID: Date: Sat, 28 Mar 2020 12:30:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.220.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, commit a6d60245 "Track which levels of the page tables have been cleared" added cleared_(ptes|pmds|puds|p4ds) in struct mmu_gather, and the values of them are set in some places. For example: In include/asm-generic/tlb.h, pte_free_tlb() set the tlb->cleared_pmds: ---8<--- #ifndef pte_free_tlb #define pte_free_tlb(tlb, ptep, address) \ do { \ __tlb_adjust_range(tlb, address, PAGE_SIZE); \ tlb->freed_tables = 1; \ tlb->cleared_pmds = 1; \ __pte_free_tlb(tlb, ptep, address); \ } while (0) #endif ---8<--- However, in arch/s390/include/asm/tlb.h, pte_free_tlb() set the tlb->cleared_ptes: ---8<--- static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long address) { __tlb_adjust_range(tlb, address, PAGE_SIZE); tlb->mm->context.flush_mm = 1; tlb->freed_tables = 1; tlb->cleared_ptes = 1; /* * page_table_free_rcu takes care of the allocation bit masks * of the 2K table fragments in the 4K page table page, * then calls tlb_remove_table. */ page_table_free_rcu(tlb, (unsigned long *) pte, address); } ---8<--- In my view, the cleared_(ptes|pmds|puds) and (pte|pmd|pud)_free_tlb correspond one-to-one. So we should set cleared_ptes in pte_free_tlb(), then use it when needed. I'm very confused about this. Which is wrong? Or is there something I understand wrong? Thanks, Zhenyu