Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp993051ioo; Sat, 21 May 2022 23:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYQWBA/S5trmzlPkBZJ++/n6auoPdCQTjPB70qGBS4TV3wdxgdin8gOsnmf3kCCZsaqRlj X-Received: by 2002:a05:6402:5c9:b0:420:aac6:257b with SMTP id n9-20020a05640205c900b00420aac6257bmr18117018edx.128.1653201528630; Sat, 21 May 2022 23:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653201528; cv=none; d=google.com; s=arc-20160816; b=Tp3YjVDM70mXdpyyGCRDauPIFKtd7Erqp5DJbgxgH1Q2KltvrbyxeSTZFudkbFlUWP 0O2cK3DfK9ggjoGt/k9IgPTgOcUzdv/Y0IpoTiSZgTfMQQY5Vr54YcJFFmJLzuHUKx6D DtGT4KWD0yPDel3E0vzJ2IsMm/XzHDDrerw31T6cqKINF6QXTT6g0xa0SIxNy+EKtxFy zjwgi8rVsbpLOfRaL1i3WXyVtTzyEcbRXfv6unj+uyJClHszOB1oHR4eJqC9TzPeJMJ2 DF6tdsDy6wdp8ACjI8bF3BEyE8P9CD7CtrdHWx8pPKJ6O4dkwOC5SRpDDe2P08aeDSX3 RSAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2yr9eRHTiR6xB9y+nGGcF+q6VztTDT49P0XoDm3K1gQ=; b=CHJ/5uObeXzSBZxl/TUubL6gQWQXlx6jd3tSeOMqy4rFR/uo1bJKlKp2KsFfUFhilp 2N8iKiFGQ+9QnymFYgDmJnGgiezqdY5b/Zgv75WH5lxt9DWg74tMU6wVjqhjNoF+GI6g V19WtiLb4KM6B9M2RUcYCAM68LX8FR5+gbragiZvbaq4lOMNDiAsKq4nNMyJI440qBIx hKR8IbxNLukuG3HuT5K0BbP8aa9RLVPne9U3UvgCR0Qod5dRUBaJOfHcqFN7+Ij4Fvx4 WSzTz1ixcHG0CtrIEWxUXwyDc10RVi+1l9Ap6ljVmJ6AHYvMqIH1kv8TDWSCKq6meaow zxSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cqAJFUxn; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170906794a00b006f3a30194c5si7904685ejo.901.2022.05.21.23.38.19; Sat, 21 May 2022 23:38:48 -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=@gmail.com header.s=20210112 header.b=cqAJFUxn; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353683AbiEUFK2 (ORCPT + 99 others); Sat, 21 May 2022 01:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238318AbiEUFKX (ORCPT ); Sat, 21 May 2022 01:10:23 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B9FC179C2F for ; Fri, 20 May 2022 22:10:23 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id j21so9117333pga.13 for ; Fri, 20 May 2022 22:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2yr9eRHTiR6xB9y+nGGcF+q6VztTDT49P0XoDm3K1gQ=; b=cqAJFUxnMFwHLhcqYZm9p2ALjMvK2C03vZrl8dWULTYLEepI8fiI6589IIs+lFRPbW rDC3EinQOYCNwoMyugPiNvICK+/iqoE0MK/V6TADEYt2hI0V8LABzFLyEtf4oj1KLakt vKXSU9OmFWwVUhW+j+whyYfy+4cX7xlkBkapbURzCIPUxASvKtwk1dlElOUw1m2U/kkK 7jFoUUAYxNCspMkSOrclTvFtVOHyI3NqhoAcnoVlFiipMu93mUgCUhy1ELWbDFxWiviO Ov3Oy+dh+XeYC7Z7E13mo7A0pkKw/ZsehFzpREpnz6vn4wRSWDZA2Po/frjWYDKViJiC Cn8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2yr9eRHTiR6xB9y+nGGcF+q6VztTDT49P0XoDm3K1gQ=; b=vWX1ggQh0h/zwPYzeJgoVHg+S02OUN1+7Eetd/e4QJDuldwdFx0esVmSpflMSTuNH7 UIl9bxKMONLF8+v57rFfYOS04NXUGNSNFksLCWZkMqAhv2qKFovZluwijq6I8pdrAg4o HZLq6HYQMLTbgxjXkcF4XXK0sV1DBq8p6wcq8sQA9te0aE/7LBL2r2XR6ObW7Qu4MT7k aMx8QzIjv5TC5eBgrKlVLwTe2VMy+ZwyzghVwVYbNY369jtO1xjxZNBK8TlK4yybIpCP LAkSaX5l+4j2bnY5rIaL+GAlasmK7RqoFknPk6QNvpk/ZzWoaE+DFOJXXfhi11DNXgMG 773w== X-Gm-Message-State: AOAM530vUxlIAs14qwoIyNizI6dBkPLCjOuROc46rMNv9PC50KctKUuc sOHfizFQu5hUKm38zOGzazU= X-Received: by 2002:a05:6a00:8c5:b0:510:6eae:6fa1 with SMTP id s5-20020a056a0008c500b005106eae6fa1mr13019494pfu.12.1653109822625; Fri, 20 May 2022 22:10:22 -0700 (PDT) Received: from strix-laptop (2001-b011-20e0-15d4-84b3-8c62-a0b8-199e.dynamic-ip6.hinet.net. [2001:b011:20e0:15d4:84b3:8c62:a0b8:199e]) by smtp.gmail.com with ESMTPSA id x2-20020a170902ec8200b0015e8d4eb234sm590603plg.126.2022.05.20.22.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 22:10:22 -0700 (PDT) Date: Sat, 21 May 2022 13:10:14 +0800 From: Chih-En Lin To: Matthew Wilcox Cc: Andrew Morton , linux-mm@kvack.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Christian Brauner , Vlastimil Babka , William Kucharski , John Hubbard , Yunsheng Lin , Arnd Bergmann , Suren Baghdasaryan , Colin Cross , Feng Tang , "Eric W. Biederman" , Mike Rapoport , Geert Uytterhoeven , Anshuman Khandual , "Aneesh Kumar K.V" , Daniel Axtens , Jonathan Marek , Christophe Leroy , Pasha Tatashin , Peter Xu , Andrea Arcangeli , Thomas Gleixner , Andy Lutomirski , Sebastian Andrzej Siewior , Fenghua Yu , David Hildenbrand , linux-kernel@vger.kernel.org, Kaiyang Zhao , Huichun Feng , Jim Huang Subject: Re: [RFC PATCH 5/6] mm, pgtable: Add the reference counter for COW PTE Message-ID: <20220521051014.GE1508515@strix-laptop> References: <20220519183127.3909598-1-shiyn.lin@gmail.com> <20220519183127.3909598-6-shiyn.lin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Sat, May 21, 2022 at 05:08:09AM +0100, Matthew Wilcox wrote: > On Fri, May 20, 2022 at 02:31:26AM +0800, Chih-En Lin wrote: > > +++ b/include/linux/mm_types.h > > @@ -221,6 +221,7 @@ struct page { > > #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS > > int _last_cpupid; > > #endif > > + atomic_t cow_pgtable_refcount; /* COW page table */ > > pmd_t *cow_pte_owner; /* cow pte: pmd */ > > } _struct_page_alignment; > > Oh. You need another 4 bytes. Hmm. > > Can you share _refcount? > > Using _pt_pad_2 should be possible, but some care will be needed to make > sure it's (a) in a union with an unsigned long to keep the alignment > as expected, and (b) is definitely zero before the page is freed (or > the page allocator will squawk at you). _refcount may be better. I will try this at first, and if any other thing let _refcount cannot be used, I will consider _pt_pad_2. Thanks!