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 BB175C47DD9 for ; Wed, 28 Feb 2024 18:39:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23AF76B00A1; Wed, 28 Feb 2024 13:39:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EBA46B00A2; Wed, 28 Feb 2024 13:39:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08C536B00A3; Wed, 28 Feb 2024 13:39:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EAAC26B00A1 for ; Wed, 28 Feb 2024 13:39:06 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C029D1C1499 for ; Wed, 28 Feb 2024 18:39:06 +0000 (UTC) X-FDA: 81842074692.28.4036A28 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by imf02.hostedemail.com (Postfix) with ESMTP id EA5A68000F for ; Wed, 28 Feb 2024 18:39:04 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=vIiRyVvP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.128.178 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709145545; 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=7iqFBA+LWwnU3gwgoROsymeSLKp/pJPiwqlUMLON2K8=; b=6DyiOJOhJZkAlsp5LIP74Vftw0VBawYagpWmD/QNe1rUnbH1taxdZ6YqUugU2WW/0seA8V bScZi2qlHGo5kEFzjhDbnZH8gJnDrl/e6cm+LGPiUql6UhufmBxpZttsvKM5vLjxlRa7Oq YZ9Gy3MA81Szjfve0lFROW3xycbJ7qE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=vIiRyVvP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.128.178 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709145545; a=rsa-sha256; cv=none; b=gnz648TccwiHCaKFGUzhKbrXRssU4DEIgR47tLZSKlKGB7WZ+Okp5XqyWcmT9V8K0KDDns 0MZRwWetO3IRvcYGdH+xWPmkYRUmY1cydCQb5J0//WyY2pXt9a7mTfdTkPCPxeNMoV+REN qVG9JuGo9nPy2HRYwWFS1mQ5xB40jkE= Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-60925c4235eso617837b3.3 for ; Wed, 28 Feb 2024 10:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709145544; x=1709750344; 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=7iqFBA+LWwnU3gwgoROsymeSLKp/pJPiwqlUMLON2K8=; b=vIiRyVvPelr8wvV/Kb4oGSoacMaTxqWxyWmzy8ujhW1oaQEtHnm1fdd/Y4Uykcdz4U MDY92ySS/O8obuYqIvnkQkVRIZCRGDWs+Lv1IzONQySArJw0EEU4b1KR0pe/hXZEH22N 1uzXXATv0Ihvkn8Hlt01HTndKJ5UhQ8J72jJhKjt84JSPbhOdlR4iI+0/XAdP69+vsdM ZjfLAvgcg6DKc/5tvVUfbmTUK/CtrvWm1hR3fDpDzOQIVJrCpThNCduTRpREcCFKzx8j 1W8xuq/0K8zh9KV/4y/YVSS60Kg8P3aTfpi5eIaX2LhHhrwrGaxWvtNng5u6gttzSOci wbsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709145544; x=1709750344; 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=7iqFBA+LWwnU3gwgoROsymeSLKp/pJPiwqlUMLON2K8=; b=dnW/FVgYJ9a+pCbNqP1yoQ2XZyj3hrXxaAi0E49DaE0hxdlXt4GFpS/eVu1Cej8wvq llDGY4B45ZZeZZ2jOGy6T05Zzjk9eKNHwoIZrKSPK296R0NFLfDCA9SJDl5F/vYUghST BbOsrJZbLzg+CyWs97sEHtn598Oqt0ljhUpHR+JjGavf9lSQrnldVw4NRNjTaP6WRZnX VpQqZrmCDwtujf/B2EEeAEfDuAGlRE9S8znNUcD4tL41cFM9ceOniNXbM1FfrF8dVjYs qG5t4vuak99nE0Z7O6L5OV6MA/ELZttpzLLz3ivkP72DmrXBgaLVTrFkhk0LeiXoACPA px3Q== X-Forwarded-Encrypted: i=1; AJvYcCX6ghfziDVDuMqaqljiFF87ZvENIhqV9ZdsghrXF+f0orOxhq89Hwgj2og5HHbIfC/zpxItwa7UXTqp2fKZgdX9Tx4= X-Gm-Message-State: AOJu0YwZMytdO0VEhNqggsCzErliJGqG9vu+YnULk6rrx+u/hOn1wDWG ciA9Eh96rphYKDY7eUcLAZCcB37L4/nHz1pjPAgp7crx8Lm+02LH/gXBvpNROtEPpRKKIByyMgl EqNuoHsfBbrx/Iz2V2LP+pd2EjhKXzZVFzirE X-Google-Smtp-Source: AGHT+IGPWnLmF2TVmBJmUMEp5oMR8c6WgnFtjjNeDdqebhJZ+NPAbFsWrA/RAsFNPaaO16thY7f2/GzzgeasEYFaVaU= X-Received: by 2002:a5b:f45:0:b0:dc6:e75d:d828 with SMTP id y5-20020a5b0f45000000b00dc6e75dd828mr48009ybr.18.1709145543730; Wed, 28 Feb 2024 10:39:03 -0800 (PST) MIME-Version: 1.0 References: <20240221194052.927623-1-surenb@google.com> <20240221194052.927623-20-surenb@google.com> <2daf5f5a-401a-4ef7-8193-6dca4c064ea0@suse.cz> <6db0f0c8-81cb-4d04-9560-ba73d63db4b8@suse.cz> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 28 Feb 2024 10:38:49 -0800 Message-ID: Subject: Re: [PATCH v4 19/36] mm: create new codetag references during page splitting To: Vlastimil Babka Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: EA5A68000F X-Stat-Signature: ug5qktfucsew1r7deq4c3ubnhnbdzdq6 X-Rspam-User: X-HE-Tag: 1709145544-658204 X-HE-Meta: U2FsdGVkX19kXGNLYcw4qBteVuvlYGJBk6ek9LugygOLy05RLKCWTGvhb/npuNSkBYDs6+ACOW5pp8Eq9GtPddlYROzjvyuLq1J1aHYqKWt0DZVppT01kSnMAy2LnLbnu1tSXctkYRcZsYHxS65nHV8mYwjA2FNXcgvNyAhuQXALBFgAnuUmwf477W51x6THZd6SOgjYZUyW8z5erbZ8JzKMSh1/wsmtBgrIh/URZ/GNGAIgs28I38arUyJ6W95kCeanl6Wxhq+fDuPn4dVugG1G4gcKxYQB6HolEb0wGakSS67Q+1K/KoeNWadCE8aVrCq+s3pZJ7jVr9UQKfc1OkUVqBrKQHzwvcGUBs7xGS0ajmM8sAh7Hmt7BndI1IUq8mr8Y7xwZT7Q6MHr2wZduxjpDLlvDQkE3QiEWLA1F9ikGGcnKpZjlYEvN0leR9A6VbYXl9DlbN9KzUUqSSITPIAs1XiuJHbdlVBfvqHHdylgKQIPZ8+zNWfRrA7fbvCUmLRABeWDGtXcDfpZ5+/i3JYHx3S2K8S6+PyLkhA3GwIItMXHtUWnmFgI1UcMQrA9ZkWtL/wlT99AA7vg4UacSoL3mOKiahzOXT9AwsNoRiMU9o3b1iOSUFwCUap6iW6sfeM+FfWhcYwTxpB4QlLN75QIv2dx8PmlzH81C5xH1unuF4tKLjStPDgfu4oUdszWvr4eB7xIWBt1tZ2dIccvkCeKfWOwUqkzUwQ6WH4IH45uw6B0bw5CrR/m0RF5Y0P78r9A0bZ4Eg11Yzqe6djeQe6UyoKJ8MgR4AhEGMfXHmudZjUExp+2LdUAW25G8likO3gm2FIfobQZlkpIEIS9bfJBQub6tFGm+HjFlajOQxsiZNWc+wnvulWVvw3KzCT74TCbVF3Kl4BHWNcwcCRgGcchxTXgF1Whv3cq+5ScfZzpPzooufdONrD/Tv+O5vf7CoSrbgc6XGa+v69N+Mf F8ddjF3M KncGg1yu3h1aBxeSkpGfoRZ9vP+jBoZGKxih7naSiqRcHQyOJRPyIugprcFvdhhJOJDtxc5uzQdRkC3O/KEYUqkTlW+E5ms9F1L+plrH5y+fLpF302tfCyveeBS5I9AYDKPTFMgLinKSbkJKpaPA6GGg4qN0eyRPICJy+W5WY09CEUduroc6O85WUlb2/maF7xcZyGmXyCBXI96P5Lgjf8k/fNHkcWUYQWC7b+3Q5iTnSnL/vHwi59h8dHO6Ll7aR3vUiD5fYWjM1BfYstYo7rGesYAus48sxaFllsDUJJPuLKb0JtLVl/Tu6cJNXMeXwrop+Dcn3HpfvDuO42fN+c14nkB1kskT3qswN X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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, Feb 28, 2024 at 10:28=E2=80=AFAM Vlastimil Babka w= rote: > > On 2/28/24 18:50, Suren Baghdasaryan wrote: > > On Wed, Feb 28, 2024 at 12:47=E2=80=AFAM Vlastimil Babka wrote: > > > >> > >> Now this might be rare enough that it's not worth fixing if that would= be > >> too complicated, just FYI. > > > > Yeah. We can fix this by subtracting the "bytes" counter of the "head" > > page for all free_the_page(page + (1 << order), order) calls we do > > inside __free_pages(). But we can't simply use pgalloc_tag_sub() > > because the "calls" counter will get over-decremented (we allocated > > all of these pages with one call). I'll need to introduce a new > > pgalloc_tag_sub_bytes() API and use it here. I feel it's too targeted > > of a solution but OTOH this is a special situation, so maybe it's > > acceptable. WDYT? > > Hmm I think there's a problem that once you fail put_page_testzero() and > detect you need to do this, the page might be already gone or reallocated= so > you can't get to the tag for decrementing bytes. You'd have to get it > upfront (I guess for "head && order > 0" cases) just in case it happens. > Maybe it's not worth the trouble for such a rare case. Yes, that hit me when I tried to implement it but there is a simple solution around that. I can obtain alloc_tag before doing put_page_testzero() and then decrement bytes counter directly as needed. Not sure if it is a rare enough case that we can ignore it but if the fix is simple enough then might as well do it? > > >> > >> > >> > Every time > >> > one of these pages are freed that codetag's "bytes" and "calls" > >> > counters will be decremented. I think accounting will work correctly > >> > irrespective of where these pages are freed, in __free_pages() or by > >> > put_page(). > >> > > >> > > -- > To unsubscribe from this group and stop receiving emails from it, send an= email to kernel-team+unsubscribe@android.com. >