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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D4FEB64DA for ; Thu, 6 Jul 2023 00:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbjGFAwy (ORCPT ); Wed, 5 Jul 2023 20:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231281AbjGFAwx (ORCPT ); Wed, 5 Jul 2023 20:52:53 -0400 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3251722 for ; Wed, 5 Jul 2023 17:52:52 -0700 (PDT) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-576a9507a9bso19812297b3.1 for ; Wed, 05 Jul 2023 17:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688604771; x=1691196771; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=brYvfzxZIpzg2ekRWtSDETsKA5c6SQ0IrxunDSGxGEc=; b=xC2HINTq+WsZ6bkXuW3ZbQpuGJQPT0iM01isllTqlWtK8a2fGIX46T+CbpEjT8G16s qDwnKfQKJVRy3oyeXo3yIpwxKde63vyF9pF0VSWiUoHLL8dLOXgHf+38v8oCfcvJw4Er ejlXEu+OTpfpAhBvOyVGD80VixV4DfU44J6sigPGD6rA2/MjKGssOiRnE44ygD7T63vp t+E6BvJuJrICBNXpe1Szr6pynzSjeStiuBoj25z5M9pljiFW7x7bX1duA718XuUIxoIv aPIZ+mwTRAfYj6FjsOtWyUjzjmTTqQ+MgOlxxBZxAlxSWo3w6TfWylHqInFCKAu2bu68 t/Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688604771; x=1691196771; 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=brYvfzxZIpzg2ekRWtSDETsKA5c6SQ0IrxunDSGxGEc=; b=PzjX4jiYzoQB581EF8Kfo2nmeFxDm8uZ7MucEbb+mJWTmaVToVnVBr5nipCpETiwbH X3gEVbZiGfMMVfFicjAfKarig1dGl7dNoGUy5z5ldM+7MGlbEZNpBxy1bTJZQxaSH78D RNnzwXwf24wEHh0/R3VtyjvXi3t3Y9MQuC24IaCjrDnliz+v74iQCo4sAvPNHDWD5+Om B8v71ixSXSiHL7AGbM9F1q0ClLuJ5RAPT2cv9/CKcRSApfHzk0bLpwkkJ54MFYNvLzh3 M348xa1rxttJmu9kXjVO/cLMSLcZWZBm/IigTdXWRZAI9dKY5eJM9Hp47GGMPzgANRrl FveQ== X-Gm-Message-State: ABy/qLYR0anaghUtr8/V+jrvNTUOf4WE69vaSDMd722e4znJJslJ+Uqe zubhvY1pXr5GdPYr0+bEC6h1+Q== X-Google-Smtp-Source: APBJJlGRAVoxAYVowQcijWwmVf4ESHfCTlO+TpznIilMWn3o7JH0E6ojbd/bR9jPjq/VIj7YN/NLDQ== X-Received: by 2002:a0d:dfca:0:b0:56c:fbd2:edec with SMTP id i193-20020a0ddfca000000b0056cfbd2edecmr557929ywe.6.1688604771513; Wed, 05 Jul 2023 17:52:51 -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 o207-20020a0dccd8000000b00568c1c919d2sm29463ywd.29.2023.07.05.17.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 17:52:51 -0700 (PDT) Date: Wed, 5 Jul 2023 17:52:40 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Alexander Gordeev cc: Hugh Dickins , Gerald Schaefer , Jason Gunthorpe , Andrew Morton , 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 , 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 , Claudio Imbrenda , 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: Message-ID: <8c6a4a46-2d17-8cfb-50f-f89f1d44973f@google.com> References: <54cb04f-3762-987f-8294-91dafd8ebfb0@google.com> <20230628211624.531cdc58@thinkpad-T15> <20230629175645.7654d0a8@thinkpad-T15> <7bef5695-fa4a-7215-7e9d-d4a83161c7ab@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On Wed, 5 Jul 2023, Alexander Gordeev wrote: > On Sat, Jul 01, 2023 at 09:32:38PM -0700, Hugh Dickins wrote: > > On Thu, 29 Jun 2023, Hugh Dickins wrote: > > Hi Hugh, > > ... > > > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > > +void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable) > > +{ > > + struct page *page; > > If I got your and Claudio conversation right, you were going to add > here WARN_ON_ONCE() in case of mm_alloc_pgste(mm)? Well, Claudio approved, so I would have put it in, if we had stuck with that version which had "if (mm_alloc_pgste(mm)) {" in pte_free_defer(); but once that went away, it became somewhat irrelevant... to me anyway. But I don't mind adding it here, in the v3 I'll post when -rc1 is out, if it might help you guys - there is some point, since pte_free_defer() is a route which can usefully check for such a case, without confusion from harmless traffic from immediate frees of just-in-case allocations. But don't expect it to catch all such cases (if they exist): another category of s390 page_table_free()s comes from the PageAnon zap_deposited_table() in zap_huge_pmd(): those tables might or might not have been exposed to userspace at some time in the past. I'll add the WARN_ON_ONCE in pte_free_defer() (after checking that WARN_ON_ONCE is the one we want - I get confused by all the different flavours of WARN, and have to check the header file each time to be sure of the syntax and semantics): but be aware that it won't be checking all potential cases. Hugh > > > + page = virt_to_page(pgtable); > > + SetPageActive(page); > > + page_table_free(mm, (unsigned long *)pgtable); > > +} > > +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ > > + > > /* > > * Base infrastructure required to generate basic asces, region, segment, > > * and page tables that do not make use of enhanced features like EDAT1. > > Thanks!