Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29793349rwd; Wed, 5 Jul 2023 18:07:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlEouFfKDTdeKVZfcpwQitMrZiTPcpk0BJdyaTtXozSPUi7h5Yljqh/xDVFfRPX4AfrErHv3 X-Received: by 2002:a05:6a20:3951:b0:12f:acc9:286 with SMTP id r17-20020a056a20395100b0012facc90286mr1181713pzg.17.1688605663979; Wed, 05 Jul 2023 18:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688605663; cv=none; d=google.com; s=arc-20160816; b=wt2AbYl/4aTNQhICGFprbQ8kRg+ypDQeNsksxd9mALgd0r3RXJl2nJuk86+HahHD9T 1o2452iiC+EyxBY6rKMojwRZlBNT8H63Nf7fBe0VlvrvnoNOKPu1cQSuCvy1Zq5xZfff 3ZaTZbLnbPVU9OwqAGxwuW6R99EU539bFUxNyrnUJUg1YaZs0OrATmEJEU+FCqLMCgE3 Ma3/403m0kHTk5Mj9elcFWLrrTgWYlR/TehNeJM1ATFh1st2mtXOtyn+AYp0oWKC9no2 h7bITr1h4zWnZPu883qBiidVnrG5cYl0tzj8Xtn4k4vclWV7TRKhv/amaXLXBvT2Xnq0 ArCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=brYvfzxZIpzg2ekRWtSDETsKA5c6SQ0IrxunDSGxGEc=; fh=6T18gsK++wUDFzGfAkV3mkylei59xggChcPrZ4QxkXs=; b=TGei2VU6DH7r7WIGj+/iw0oJdH9O5oDm5AaG+te0xggH3blEe0A7LHAqxJ/NJJM1SE gNfGnSj3Zliz+rULdUIw3eBoQAUbKR4iTiW9c/xW58bYUEtdqLRGC3R6YnqV32cNvoeQ j15I4t/lBY/pJ/qX2VLvUeCmQj5yzBAAcxSjNQcU24gJFFz3xGUBe7D5O9nzaBLcr+Dy AaTwTwuXMMXrEGQHbTS6JIc5rC/4wua73q47M7YV414JuNBK/ue3mrAZxwoOADw0n5DO r/NKgeXCurugkaHgYAUsVkPWoU9t+/LU256wJVOVT13SpqWD5WFduJlyx+f0cGr00XT8 Lmxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=xC2HINTq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv123-20020a632e81000000b00536b4c4b695si392039pgb.136.2023.07.05.18.07.31; Wed, 05 Jul 2023 18:07:43 -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=@google.com header.s=20221208 header.b=xC2HINTq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232801AbjGFAwz (ORCPT + 99 others); Wed, 5 Jul 2023 20:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232489AbjGFAwy (ORCPT ); Wed, 5 Jul 2023 20:52:54 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7061995 for ; Wed, 5 Jul 2023 17:52:52 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-5768a7e3adbso20064717b3.0 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=ABi54mis9uY1+wY1EJgZ4NFX1q4nGmZoRv5DVNSIMp0qjw9IsUMqj1J+vv5r+4mfM3 NvfkDlmOhks6NttBDl4KDI1ds1GlY24pl61D03WJF7g69RwtiFfjaoD5j9pI2CVvJqtD StFQ2yJ7L6uRhPlb4I6ps5EoOSr0ZDX8u+cNZeNEjfdBWgfQWfNmT2IEQfEYgSI2vRb5 OclBNrNYfyduYvPg7MqaNAmAWcFhbzcsJIYYWRtPk5gZ+vQxQguhgWF3xv83USMZMQCR LaqdVHaTlCL5KH+2SEVxgz6tmeZ4QG+fr6976aPgB3nt7P68J9rALSPpkYmSw08LpSxY wkFg== X-Gm-Message-State: ABy/qLapBfvkVSU5uS7OncEtyxUWyRxZmZ2IuRXqSxyyKKeHbw3Pk+Qf 4P4Oxqb92w+cPtZEq0LjtqdrGA== 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 X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 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!