From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC54DEB64D7 for ; Fri, 30 Jun 2023 15:29:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FC8F8E0029; Fri, 30 Jun 2023 11:29:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7AC578E000F; Fri, 30 Jun 2023 11:29:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64D6F8E0029; Fri, 30 Jun 2023 11:29:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 537248E000F for ; Fri, 30 Jun 2023 11:29:10 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0B0FDC0573 for ; Fri, 30 Jun 2023 15:29:10 +0000 (UTC) X-FDA: 80959797660.02.8DF4E95 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf03.hostedemail.com (Postfix) with ESMTP id 120D120020 for ; Fri, 30 Jun 2023 15:29:07 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=OrFdTzSQ; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688138948; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AjAYnVeboGLbIm0tKT9e16Vsq7Oo9WWm/R7Yf2CYkqU=; b=wYw3i1/Fd7MI0nCVwLsZK43HXzDrX+Fc52qinIK8ZKEnS8jT47GATCIm+4Z6AbydJBwLUN bFHMirpBWCHSMdJXDhcNK06B3oa+iY0y9GDWMOISPuA/uUKn323Dp5BYKisLYXXOXVIBq+ ybt2itLqWSbXIFTajJvaDKMEXKMJWfI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688138948; a=rsa-sha256; cv=none; b=MfCSH/xmq7jpDxK8LmGMvnuIqtFUb6+w0ClaOjZ/PRDjAFFbGdeusVw2PlZPee8m3D9gQ3 lYH0KVIEUVRlZ8qqJ/XzPT4Utw7Rs4Tzu77U92e+T1w4/usoNGW/n12eHb5pTlcS5Cgqj9 oe5j4anvIkNmv9gccLMrhRGU7KUpB38= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=OrFdTzSQ; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-c15a5ed884dso1924087276.2 for ; Fri, 30 Jun 2023 08:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688138947; x=1690730947; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=AjAYnVeboGLbIm0tKT9e16Vsq7Oo9WWm/R7Yf2CYkqU=; b=OrFdTzSQQkVcKVrUqqdFxWYPfui4NZ+US05WE6v2rnqFm6OACvYRXXvuvVVn9/WgtH IO25JQBx/7LBuF94N8uGWuA7lOqK/g2aZp1o+jdYwvLq2sHeGN6e7HBrH9hoQ4jtcPqs 90eQkQW0JM+WPNUbFUyKu7cCa3Sn5U5Jf2hFgFgK4apj0UpwkpB4OeYiFgRXknc7EB6e QGvEjMl6zgdHa4GtApbCh6wEU0EpLaffyB3TGQ3swbjHsGW/3I5351vpgsD4dqv93K97 b7yuMuqA/UWI4+PDCNp0ztgzGA9UcYiCsSREvoSv8SCHEvA6U71YyFDKLcORLE5cGOxV 8bcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688138947; x=1690730947; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AjAYnVeboGLbIm0tKT9e16Vsq7Oo9WWm/R7Yf2CYkqU=; b=OI/bb7Np9xgSf+NpxQB1mKtXFr2NWc9er7DKrlZjeQEvdoGY1S2fqjrgMSwTbKO75V FGdlHI0NYhhzqo47UoKJJ54GBKncxqsLKdtXxcjAsorVrc5HjJHd1582TZysWIy82yc3 5PskJdprFnHLJAciKLcf0BFBJpN+yaqa4VPifpd+v2HobEmIIVHmWCZfUbMVXt2k/P9n Ms9lfev5hBsD51oWgplfx94Cn0JyTOwO0y3S0hY+jXhe0CvMhbIki8+pccqH/fim9Jxy CmsHkqzqpmadS9yNCcnstKB2Ejk3IimksQrKt3LY85QlyyPWd0+WOpqe9eW2rz9HWJUc +ssg== X-Gm-Message-State: ABy/qLYZm2pZM+LJ145OjCYKqDjW2+At3O1jxqYw0UuDhOL+iq4POgpL R4C8EEvCjsX6SHJY0zVycuiA1Q== X-Google-Smtp-Source: APBJJlF5EFV8fGkahr4C63tlYCJc9C/Ov9as/Fr8WIXMxA7p0Zq+iobFwmSBQKWq4vNdROS9uHFFYw== X-Received: by 2002:a25:d303:0:b0:ba8:9512:fbc9 with SMTP id e3-20020a25d303000000b00ba89512fbc9mr2919284ybf.11.1688138946703; Fri, 30 Jun 2023 08:29:06 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 144-20020a250496000000b00c3da591adbcsm635911ybe.31.2023.06.30.08.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 08:29:06 -0700 (PDT) Date: Fri, 30 Jun 2023 08:28:54 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Claudio Imbrenda cc: Hugh Dickins , Andrew Morton , Gerald Schaefer , Vasily Gorbik , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Lorenzo Stoakes , Huang Ying , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Alexander Gordeev , Jann Horn , Vishal Moola , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 07/12] s390: add pte_free_defer() for pgtables sharing page In-Reply-To: <20230630153852.31163592@p-imbrenda> Message-ID: <062b19-4cf1-261-a9bf-9cefd32382fc@google.com> References: <54cb04f-3762-987f-8294-91dafd8ebfb0@google.com> <20230630153852.31163592@p-imbrenda> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Stat-Signature: itmwgmp1rjhsazd191emtqjhmkufgipi X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 120D120020 X-Rspam-User: X-HE-Tag: 1688138947-927506 X-HE-Meta: U2FsdGV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F/ndfNLmiGc4igbtHh63qWeMxYVvEAKyNMpLZk64w6qglqK/Nj1BWdoBqrvYxk/+PFwzgHm/zveEcfWTDcNsJ7mXGb/1t6BdjO5ruo6h+FBiMJ6UP6PXMf2gfyRTsjHRdvRMEVRlcwUpLEPXlq8AFbhI4RTucOtg9LV+5f6sUCPlhWldBarWkb5jxT2u5z3jTMna2Q2ktE+6gXnmXfz+75NGokHQsjT18jM7IixxlhBvi2nju8rq/wVYsE5/pSe89cjNXPDgfVq87wJnWKJuqRbveWYkCzVvGzjB/Meiu3Qul/OwXFHezYC0j9CeTDZJxijo2gtSN0kjGQJnBU941lj4JH+q7DPJIqLzzs8CC2b+KIOw+mTKVx9dB9jkwiGBCMMPm27MO7P+m0+ZrG6BA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 30 Jun 2023, Claudio Imbrenda wrote: > On Tue, 20 Jun 2023 00:51:19 -0700 (PDT) > Hugh Dickins wrote: > > [...] > > > +void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable) > > +{ > > + unsigned int bit, mask; > > + struct page *page; > > + > > + page = virt_to_page(pgtable); > > + if (mm_alloc_pgste(mm)) { > > + call_rcu(&page->rcu_head, pte_free_pgste); > > so is this now going to be used to free page tables > instead of page_table_free_rcu? No. All pte_free_defer() is being used for (in this series; and any future use beyond this series will have to undertake its own evaluations) is for the case of removing an empty page table, which used to map a group of PTE mappings of a file, in order to make way for one PMD mapping of the huge page which those scattered pages have now been gathered into. You're worried by that mm_alloc_pgste() block: it's something I didn't have at all in my first draft, then I thought that perhaps the pgste case might be able to come this way, so it seemed stupid to leave out the handling for it. I hope that you're implying that should be dead code here? Perhaps, that the pgste case corresponds to the case in s390 where THPs are absolutely forbidden? That would be good news for us. Gerald, in his version of this block, added a comment asking: /* * TODO: Do we need gmap_unlink(mm, pgtable, addr), like in * page_table_free_rcu()? * If yes -> need addr parameter here, like in pte_free_tlb(). */ Do you have the answer to that? Neither of us could work it out. > > or will it be used instead of page_table_free? Not always; but yes, this case of removing a page table used page_table_free() before; but now, with the lighter locking, needs to keep the page table valid until the RCU grace period expires. > > this is actually quite important for KVM on s390 None of us are wanting to break KVM on s390: your guidance appreciated! Thanks, Hugh