From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACE53A923; Tue, 13 May 2025 01:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747100534; cv=none; b=S68MUuuKhruhs3w/DFO58vulbKV/ZJoY9Fofrx4EH2opalJYDyiDYb7Obhuq4AqbHBqwQ48CYIyd2Qn8NIJd7CJCz7/T9uHRTy6yKTrGPlm0d06YkOklPPaDDHqAkGst8BSXIzryKzN2OdYFHmRUDA91lMsI3GiZgtQqIZ9gCAw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747100534; c=relaxed/simple; bh=rYDxXy9y3PLlV7ocDiHDrUaSVSn/oVTrMP9BcBY02Ak=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WHptrz3u4ApSws6qazwbExDHlIAoFzY8co3/mIrp20ZXM1IVY5dnhGr+ZAtjxkEXAjliwVhS9DDK/HIrvTNwuMQ64oa4gEnrupwlGavWqv1wHwf6CtBUg0udCMsFb1RdPqT0NkW/L7TSwv+pN1wCknj3Xg781eycAy7f7Iidd+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-681ff7000002311f-f3-6822a36d9452 Date: Tue, 13 May 2025 10:42:00 +0900 From: Byungchul Park To: Matthew Wilcox Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, kuba@kernel.org, almasrymina@google.com, ilias.apalodimas@linaro.org, harry.yoo@oracle.com, hawk@kernel.org, akpm@linux-foundation.org, ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net, john.fastabend@gmail.com, andrew+netdev@lunn.ch, edumazet@google.com, pabeni@redhat.com, vishal.moola@gmail.com Subject: Re: [RFC 19/19] mm, netmem: remove the page pool members in struct page Message-ID: <20250513014200.GA577@system.software.com> References: <20250509115126.63190-1-byungchul@sk.com> <20250509115126.63190-20-byungchul@sk.com> <20250512125103.GC45370@system.software.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsXC9ZZnoW7uYqUMg6lP9C3mrF/DZrH6R4XF 8gc7WC2+/LzNbrF44TdmiznnW1gsnh57xG5xf9kzFos97duZLXpbfjNbNO1YwWRxYVsfq8Xl XXPYLO6t+c9qcWyBmMW3028YLdbvu8Fq8fvHHDYHIY8tK28yeeycdZfdY8GmUo/NK7Q8um5c YvbYtKqTzWPTp0nsHneu7WHzODHjN4vHzh2fmTw+Pr3F4vF+31U2j8+b5AJ4o7hsUlJzMstS i/TtErgyHny6yV5wRqTi1cITrA2MB/m7GDk5JARMJPrX7GSBsRfcf88MYrMIqEq0z2tmArHZ BNQlbtz4CRTn4BAR0JB4s8UIJMwssJRZYvpUYRBbWCBIYvLjh+wgNq+AmcSJY9eARnJxCAk8 ZZT42P6NCSIhKHFy5hMWiGYtiRv/XjKBzGQWkJZY/o8DJMwJdMKOaSfAThAVUJY4sO04E8gc CYFt7BKde3cyQtwpKXFwxQ2WCYwCs5CMnYVk7CyEsQsYmVcxCmXmleUmZuaY6GVU5mVW6CXn 525iBEbksto/0TsYP10IPsQowMGoxMN74qV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5z6cApgqHTnCfXLFrhe/xf991G 1ppJtyY+KX22q0nsYFOiQrvzO86+f0tKp+3UvjBbuuzsUbFf/i/MmY2urLTcflNa9VDwwo1K LMUZiYZazEXFiQBGBXztqwIAAA== X-CFilter-Loop: Reflected On Mon, May 12, 2025 at 03:42:54PM +0100, Matthew Wilcox wrote: > On Mon, May 12, 2025 at 09:51:03PM +0900, Byungchul Park wrote: > > On Fri, May 09, 2025 at 07:02:30PM +0100, Matthew Wilcox wrote: > > > > + struct __netmem_desc place_holder_1; /* for page pool */ > > > > struct { /* Tail pages of compound page */ > > > > unsigned long compound_head; /* Bit zero is set */ > > > > }; > > > > > > The include and the place holder aren't needed. > > > > Or netmem_desc overlaying struct page might be conflict with other > > fields of sturct page e.g. _mapcount, _refcount and the like, once the > > layout of struct page *extremly changes* in the future before > > netmem_desc has its own instance. > > That's not how it'll happen. When the layout of struct page changes, > it'll shrink substantially (cut in half). That means that dynamically > allocating netmem_desc must happen first (along with slab, folio, etc, > etc). Just in case, lemme explain what I meant, for *example*: struct page { unsigned long flags; union { struct A { /* 24 bytes */ }; struct B { /* 40 bytes */ }; struct page_pool { /* 40 bytes */ }; }; atomic_t _mapcount; atomic_t _refcount; unsigend long memcf_data; ... }; /* overlayed on struct page */ struct netmem_desc { /* 8 + 40 bytes */ }; After removing page_pool fields: struct page { unsigned long flags; union { struct A { /* 24 bytes */ }; struct B { /* 40 bytes */ }; }; atomic_t _mapcount; atomic_t _refcount; unsigend long memcf_data; ... }; /* overlayed on struct page */ struct netmem_desc { /* 8 + 40 bytes */ }; The above still looks okay cuz operating on struct netmem_desc is not touching _mapcount or _refcount in struct page. However, either the size of struct B gets reduced to 32 bytes or struct B gets away out of struct page for some reason, it will look like: struct page { unsigned long flags; union { struct A { /* 24 bytes */ }; struct B { /* 32 bytes */ }; }; atomic_t _mapcount; atomic_t _refcount; unsigend long memcf_data; ... }; /* overlayed on struct page */ struct netmem_desc { /* 8 + 40 bytes */ }; In here, operating on struct netmem_desc can smash _mapcount and _refcount in struct page unexpectedly, even though sizeof(struct netmem_desc) <= sizeof(struct page). That's why I think the place holder is necessary until it completely gets separated so as to have its own instance. If you believe it's still okay, I will remove the place holder, I still concern it tho. Byungchul