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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0472DC25B75 for ; Thu, 16 May 2024 02:29:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FF4F6B0399; Wed, 15 May 2024 22:29:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2AF116B039D; Wed, 15 May 2024 22:29:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 177226B03A0; Wed, 15 May 2024 22:29:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E7B3E6B0399 for ; Wed, 15 May 2024 22:29:10 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5516E403BC for ; Thu, 16 May 2024 02:29:10 +0000 (UTC) X-FDA: 82122676860.03.3E97BB9 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf11.hostedemail.com (Postfix) with ESMTP id 8D6F940008 for ; Thu, 16 May 2024 02:29:08 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=cXBVE0dL; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of yosryahmed@google.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715826548; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LYCuNfLlvwHYZtpoqR4KmOfB794WgDdn7oymPKXrw28=; b=FU2E++hYB4WqEnsUWC+UPWj5cTW4iK4GyDrs5jCJTfmVixaKiDuw6TxYUbK0nxlsTayisz ZTnOnYIn/C8VzviLBGJcvqw9mdfafh+yo7DAviCLxDmzpmY+dtr+oPFRO1PDgRVvHaKsWA dUU/5+vPNrmxq9MQ/6GOtxSiRoB98dI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=cXBVE0dL; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of yosryahmed@google.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715826548; a=rsa-sha256; cv=none; b=Gy9FfF4k8BSUrSE1ehDRP3TFtE0X14U6n01dczNq/y4kAI26dp48qNXPQD8u/dy9RdWXIW ushxTV+x1lbWjoUYcmlKr+lZNVjdOSbzWRr+5hnVHQVRyxxmT4culeN11Qh0mmOxtFMHGD CswanMYGuDBJM55nnD7+m0Af1c31E0U= Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-420180b5922so37996515e9.2 for ; Wed, 15 May 2024 19:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715826547; x=1716431347; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LYCuNfLlvwHYZtpoqR4KmOfB794WgDdn7oymPKXrw28=; b=cXBVE0dLDaCrDZm/y8XWFzd8vcxOoHK3Yvr80eL4YMCRd5cn5mezsZZ5EKY8fyjSmA gixuTd00c1eJabjnMnSrRpBbZ9aXFubNNz5O7+hltTFZpbyaLWXgX3nmFoLNlw92hrt+ nlU0KaI1bdFwiHaZarpvRNQjaN6xd5Aljq9vUHtcMFqK1uSJyLXO2UQiQRa79Em1XWYt IKFnTRRNvbipf5n96I4RbXZ+hXWG8vsu7Zl9s4bFsgWhsPDPCqrB3cQceryI6MrSoflJ RNVflu3HKNG0wAwNFLe+uF6vxE0IMXpXUUxo/A8IEBmz2hVyAhF/Od41yH5iUBVcAhjp txKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715826547; x=1716431347; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LYCuNfLlvwHYZtpoqR4KmOfB794WgDdn7oymPKXrw28=; b=QZKeEZOwrR9EGgcmCeMqpQdh/o7UwybvErqlWTYRo+xcGOtUuxxeuVs+1uwhJPmJ3u 4E21upom3xClnOyRca4sxrIm6lgH87laqwGVBRE3rEAdB7Sk7Ubyz0DIrpgA6VzsS9bT 9g35MAr/SDc41tTPUmiq/rnLvQbzuFkZhvKqt6yPmvFOXtL0Q/fTZQDQgArTDR7GA22f pkABBqOgCnT91JZfX9V1nC8c23qlTB5Z34uSJ2RABO+aV5mF4n341FxiUY2G4/RiCRbi TpHSAbnFFRFlJPVBj3VGdIcRdxZcF34Xo8MYWUhEflQzQBpJvwpodmYYkHJiWzm30Ju3 hYGg== X-Gm-Message-State: AOJu0Ywk64Ug/ExwN0nDxn0cypvwxWIgK7SGLDlFu9eAf8ZlRWqq3pm9 MK/azygo1V3UuV217XwjAodDlTWn5noIMWee1QvJ7dfx3G0tlRabCgHa5NcJt1Fe7ArF5oS++JK oDu0J22NCXLs/s9FPzvNe+EP9REVvVIuNcedX X-Google-Smtp-Source: AGHT+IE8TBwTXWLFCdefduT69XVIFfWvldk4y4Aa/HWWY7aEU1DtIEE0Zfa1W6hYgCzg8lla8irdwb5cxVQNPjtNVJI= X-Received: by 2002:adf:f8c4:0:b0:34a:5663:40b with SMTP id ffacd0b85a97d-3504a630f91mr14520669f8f.3.1715826546596; Wed, 15 May 2024 19:29:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yosry Ahmed Date: Wed, 15 May 2024 19:28:30 -0700 Message-ID: Subject: Re: Memdesc wiki pages To: Matthew Wilcox Cc: linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8D6F940008 X-Stat-Signature: yyitrhuy8u7g6916wh4r5teff5fzfkcs X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1715826548-753383 X-HE-Meta: U2FsdGVkX1/4rnNTW7vQpTEf+2jKrglZk1CCANPKN6ySOH8T4WdksJgrz66eNHJ/luUzXDVuf1CyeauCHKsVpzHV6TW8rTer4FE1UMj1oS7MeaU+xrVE/PqhV4CmC+Qleg7QUdFytKHaaFO6+c91XQCryskNuuSDhd23fDpirYOY233SlXlnsvkZaBxy3EQbGedwoWA6hSuYVWWdMHqpSMZ6awVZOEv4nknc8jYLylh08k4EGGo4HNzLsTEDnqYcbr1Zx2gdGcRaQF9kxWJza7lnqGJBq0hz4nspYtgpDV2Xry5Qi01rqzTv21Q9VZbyGN3xt7n7PFuzcz1R99T9lYgTazawHK30qhqpX/J/pwPCY6vmePWmo3HTDsgOAfUgnn9OoKCwPfVgqXSP/F+Jbz+0rRWTSc8/oE9pVSvVfX/MnLC2eI7YTsElYgs+UKEtU8diixlEZ4YBqBroxy2kXmSiuzSlbhriUGz7IjkAMI7uKp7hJU/cASSCbK9a7dJ6MMaYT+c12KYsqWIUs8icuP6i27onOP6HfhJaUHG0SK59HsI3hWWcZEK82Nm59iFgWCc0CQ2FmkruuxhUhVey3GDMlRS0SvJoS7Dg6P0+9rnSBjGJtLpx69u+796RAQ3vZfVoi/NKsXR2C4lgum3ZXy4mU3yZ99Y88z1NE1O2zfw03jbtwwXKB1SD52B2aPpTIQspn7rMQdWURsJXlwM5HpdArTixQZHg7S7IapVqAPQ0uvZoKloML3tEXuNSDAP2rx/7e5kckxx9n6/GWsyTVy0KR/st32bkr/KdeUuQhH7eK9vI+VPYa7PbbGu7ZNUJ3dchyEZ0bTGVoYT4cpzv+k33Y6SOodGhPIG9kDeJUEh1wrJjt+7CkKF3p3R5z+5EWuD1GXZ8sVOT38BjG0egJs3uUUd+e3qXOhW41fDMHtPkEADVtHLzEu5Xp76WdSrOQGP3QK3D4BVzfetIo7H 6tU4NcoC UuWfGH54D0dZNmU6TGEwv/AopHJ3CNLKn0TsiZmqjoVDZp5B76S+RfZ5+/RjoE1I8mBlyi6tURp9qAQpmlQyiL5kf8S0WspRfFhIH9RDQaqwmoHhz9dNwx9YKBecgk9Hszti4u7az0L8LPtZgrSFiOfmQqGpUG3/Rr6YcOY85a0B7zr3BKbAgnmf7zifE8D/YtCF2iHrzNwvCr/PCD4y7tzDCOa7CeT8vX0PQT1Fc0EbW8XUoKdA2hyHD8PHTB8snFGfgldRxcz4QUVjgeEjSV0SOa7HPgG8IVCqg7atRhbYI+lt41++H13wmnPXiCu3vagggmQ/WUIFFo3VcXBuQjSqVQg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000051, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, May 15, 2024 at 5:21=E2=80=AFPM Matthew Wilcox wrote: > > For those who couldn't read the text on the wiki page earlier: > > https://kernelnewbies.org/MatthewWilcox/Memdescs > https://kernelnewbies.org/MatthewWilcox/FolioAlloc > https://kernelnewbies.org/MatthewWilcox/BuddyAllocator > https://kernelnewbies.org/MatthewWilcox/Memdescs/Path > > That fourth page is freshly created as a result of the discussions in > the room. I'll continue to refine these pages as my understanding of > various issues improves. > I took a look again at folio->memcg_data. We have three types of pointers that we can put in there: (a) struct mem_cgroup pointer (no flags set, for anon & file folios). (b) struct obj_cgroup pointer (MEMCG_DATA_KMEM set, for non-slab accounted allocations). (c) a vector of struct obj_cgroup pointers (MEMCG_DATA_OBJCGS set, for slab allocations). I believe we should be able to get rid of MEMCG_DATA_OBJCGS now and use a struct obj_cgroup ** directly in struct slab. I see a few places where we change struct slab to struct folio or vice versa, but I don't think they miss with the memcg stuff. The only exception I can find is print_page_owner_memcg(), where we use this flag when printing the memcg of a page to print that it is a slab page (and hence no memcg will be printed). I believe a PageSlab() check may be racy, but I am not sure, and I don't know if we really care. Now for (a) and (b). I believe once struct folio only represents anon and file folios (or if they have separate types), we should be able to use a struct mem_cgroup pointer. This will take care of (a). Things like PerCPU and PageTable fit into category (b) and will have a struct obj_cgroup pointer. The problem is other category (b) allocations that fit into Misc and do not have associated metadata. These allocations should have an associated obj_cgroup pointer if they are accounted, but as far as I can tell we have no place to store it according to the current plan.