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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52573C7EE29 for ; Mon, 29 May 2023 14:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TrubhG7M3B152Ckwg+Id0wkM9DzmPSSiEm6MDsfhv/U=; b=OZqrJoOBlC6B9Q Df1aTto5xbh9MaNmDxYOtDekzJi+2hwOpl0DpxOBYnpKrpoQvub3ZbKdXxNpJSUUxfwy0ZqXisQpq bCHbHF7xZEvHRPm3d1wjnqPGjnnBlMXDN1uFS6oWE55cXpZWGiIUxj9Xzf/vV9mFlC4LuHGp+g+ZL NiO/NrNjTmRZE0UEdkDMgyUUUtPBaJSB22yW0D5uXHzKOlc5DTjrO/wNH8aJhDS7ISAHDKWGHNYWh tbiQO1JdCW+8NUyzhvXd7LealWxnapBeWkV5DW86mhYLhYdjEWSxAZoEWdJQi5ghW8uGo7ozu+UHI OhqRjcyLJYZlj9VIDsBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q3e30-00Ao4w-0q; Mon, 29 May 2023 14:40:34 +0000 Received: from desiato.infradead.org ([90.155.92.199]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3e2w-00Ao2b-17 for linux-arm-kernel@bombadil.infradead.org; Mon, 29 May 2023 14:40:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HIWQIR7wu23EvgpQrMt3Yo6E002JcBFAWWYI7+iQQZo=; b=H8VzfRKnuiETKFelbAdY8tB3Av KTk37vl7hoeXmS5vSncXVAh+notntbCZvNWqVlksNGObMd/65oLbGNPBrEyNxLK1+ztEnBHJJfc7a +m4SfzDqrWxY5W16m6sqHFA5MrrfSLJ/ZpWDuRkzeM3nnCeBxRHlkcx2kHyM0NKEEpIsZlWcOC2ag h7ryEardbGwbTyDv7LYI0Qhchz80ljr2Ksvbis7XivD4Yag3UKyY4Aec24hNnDdnZ9ZIvXp2W5WhF qqh1yCJkPxh9yWuOGN3RfQZ/qmlDfJ3SCK3MorsZd5SksHwIZ2WdgxQ1sbXQqTSrRpzfH07PQbzco KIF9R9rw==; Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q3dzl-00BufB-0K for linux-arm-kernel@lists.infradead.org; Mon, 29 May 2023 14:37:15 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-568928af8f5so11034647b3.1 for ; Mon, 29 May 2023 07:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685371013; x=1687963013; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=HIWQIR7wu23EvgpQrMt3Yo6E002JcBFAWWYI7+iQQZo=; b=hcjUS9Azm3/0RU+gKaiie6ZifVpF/OCAFapGW8HSxUO0W2rMy4ULofPLAkozr5dK65 BDXwIAbVAuU/9a+lI2H3m13nnKdLi9zmmQuy+OAud0Tyk7LSzBGneDZiQGCG1giRjNu9 uNLOY9ugLp7w4phKfq/dZQoeuFCLLe61eTU31G57MHbDfFRtSZLl49v+kfNWsWi5cnow WBeAUiF/9G+YnMzJ93YlNpiESaX402fmYTQ9v4+kFDL9TaoSMswWpzsbP6ko87Ro2qDL jCa+etQGtPqZWRpF5v3idcRSj250qlhVNpCbJ+mqK5gUOrh2LrGExHBOAMEBuLDEOBy2 RzCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685371013; x=1687963013; 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=HIWQIR7wu23EvgpQrMt3Yo6E002JcBFAWWYI7+iQQZo=; b=MY0erPO5vibN0qcibxbDBaGUzEcQW3HUoW5fVG9j+5BzhjGpkMqtKYzVPvBvNu+1l8 4mMD4AvD6NN7E/0AttWjmCgVuIos2LC0lhxYfhIptDZLydLJkJKOV90gU5ucOPECdxve 5WW62gLKPU3biPizjYLF6xLCYWc/bHIIIZYcZg5k/y5zXaCNEmur7mogEgceMSe+Riek gGSJ9vzIMKwhwWMUl8edBs/T8SH9sYmmTUpu9barKHx5dsuayeAH3frCaRUl+Km+CTf9 pzvm2Wdwmvl+Rz+GeFDmLe/gYQp/41SKE1yf6fVNDVCQEn+/zwsk28c4wGxbSOTuS0W3 DXug== X-Gm-Message-State: AC+VfDyS9tSLYxB8mC/AiNDMmKtrjIUm9j8t/5ScGZgdy1ueX3TS/5+Q Br4I03BLJlpX2HeqMYGN1qqcEQ== X-Google-Smtp-Source: ACHHUZ7JQdplHPjQnLsPrFKY4x7o6203nPCvCFds9aIA594vHBEun4NndGVaRztw2DY/LseAyCeavw== X-Received: by 2002:a81:a60a:0:b0:565:350f:3332 with SMTP id i10-20020a81a60a000000b00565350f3332mr10401354ywa.9.1685371012657; Mon, 29 May 2023 07:36:52 -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 u189-20020a0dd2c6000000b00559be540b56sm3639714ywd.134.2023.05.29.07.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 07:36:52 -0700 (PDT) Date: Mon, 29 May 2023 07:36:40 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Matthew Wilcox cc: Hugh Dickins , Andrew Morton , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , 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 , 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 , Claudio Imbrenda , Alexander Gordeev , Jann Horn , 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 05/12] powerpc: add pte_free_defer() for pgtables sharing page In-Reply-To: Message-ID: References: <35e983f5-7ed3-b310-d949-9ae8b130cdab@google.com> <28eb289f-ea2c-8eb9-63bb-9f7d7b9ccc11@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230529_153713_379905_0287202F X-CRM114-Status: GOOD ( 19.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 29 May 2023, Matthew Wilcox wrote: > On Sun, May 28, 2023 at 11:20:21PM -0700, Hugh Dickins wrote: > > +void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable) > > +{ > > + struct page *page; > > + > > + page = virt_to_page(pgtable); > > + call_rcu(&page->rcu_head, pte_free_now); > > +} > > This can't be safe (on ppc). IIRC you might have up to 16x4k page > tables sharing one 64kB page. So if you have two page tables from the > same page being defer-freed simultaneously, you'll reuse the rcu_head > and I cannot imagine things go well from that point. Oh yes, of course, thanks for catching that so quickly. So my s390 and sparc implementations will be equally broken. > > I have no idea how to solve this problem. I do: I'll have to go back to the more complicated implementation we actually ran with on powerpc - I was thinking those complications just related to deposit/withdraw matters, forgetting the one-rcu_head issue. It uses large (0x10000) increments of the page refcount, avoiding call_rcu() when already active. It's not a complication I had wanted to explain or test for now, but we shall have to. Should apply equally well to sparc, but s390 more of a problem, since s390 already has its own refcount cleverness. Thanks, I must dash, out much of the day. Hugh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel