Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp393032lqp; Thu, 21 Mar 2024 04:52:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV6eNzL9ZF77RUboPJIhLaH7Vo7Ri+s39GuuHzmfRrap9oiE4q/wCRdLU7wl6Q6Bho11IwNkjYiAc5nRd4axcvLdALPkcgJOXjvWQtD2Q== X-Google-Smtp-Source: AGHT+IHzklhmCopHRGNodWeOdceHUFkIB6BsrBYm0GnpKwqnwewdCGYts8VQXRI/OAa6fED9qux+ X-Received: by 2002:ac8:7f4e:0:b0:431:9d:2103 with SMTP id g14-20020ac87f4e000000b00431009d2103mr5055401qtk.23.1711021976020; Thu, 21 Mar 2024 04:52:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711021976; cv=pass; d=google.com; s=arc-20160816; b=U2dTIHcvDKRFT0/8V+qzMxlfKVSVBOdvEtI0nvVor2Md/Kc75TkmPJyW7X9xTNH4qa OiJoO2e/x8/Ati0yVcLnDtm2EwPA1qzcfrpHRGYz2V0ftzIbTmQ78K4GF/+zz0yYS5ql uDKoyngPOs2LmXgRnpN3oyHikdCbDey3rYISOfApR31ftlT8MoRznUw/XyEd0SlK2lWU mkJPCnONP/OSkPBGDEZ/X5Tsj6qV1cWaWI+qxew2l+6z/N3Eaijbs1tgPIqLHmnUv/dS xMvEpJi9h6SS1bDFQUKHxRBTIAGzaSgmw1cZ8rOmRsUtDtyEW0Ajxlbdcnj3HMMI8O+k 0S3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=RoFQvN3A6LuxtEgXr4JZu2gcaE63IfMSc54sFQ64riA=; fh=YfPLb1HuXa89UdINaP4JQ1p91GoiJS/GYs6Ejtj3XVs=; b=Dtee8oUAjmNCt7XBI4P7ETyNYDZxoIBr/vls2GEL3b9lLy4EQfTTVJOqM5zoRp2SRP U89NdenFExd9HU3Yf2LZXzlQOOSDN+p2f+q0AiSeiKftXORWBfcQ0OEwvfJybAzy/GNo 4tYxc4/cX8muQfVPZ67CHeKqifrSz1y5939kpSeBKcQlcANihvczMBLs4wfRdxmrrDGD cjKpBDjdUZ2hQ3bm/ySAkSdXelbjheCNsAaSiABGq4WIxm1F2F/n2j7PRM0rH6xbzm0D nAulVH0o/0QM6huSfsgDgPP+T8azhaKWUDErKan3GTutvQrL6XXQ9M3NbdAXxMVDB3po b52A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-109986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p12-20020a05622a13cc00b0043114a72283si2777972qtk.750.2024.03.21.04.52.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 04:52:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-109986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BE66D1C219B7 for ; Thu, 21 Mar 2024 11:52:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B6445FB9D; Thu, 21 Mar 2024 11:52:51 +0000 (UTC) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E6525FB86 for ; Thu, 21 Mar 2024 11:52:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711021970; cv=none; b=aaZ4oJHt+zw+bDlqZugK2CSyQvxpW/fUYkGE2PmzTBoD6QBIoCCnTJo4ICmrg5OP6oGMtAhxEUi/gJIOP240bcMskGS4LSD3G5riP/Gm1xQuTNhAFWm0J1+vX8TsIolXUM12lvLqsuqpORUSbzDhh03zxtU8WloGNEqgcPcZHUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711021970; c=relaxed/simple; bh=o2AqpfgJy55VzmFbrCOgMCQrm+/rhvOZuJ6STrHhJkk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Skdd/Qzl5hNMMFMPM6Yk9Pf4IBampDA/BQmci56GGPKbJAqar/5ISFdpqG5pwtxC1+7SQA7gJ41nesrkZwr0uPM+kxPm+ALEyn1jb84qW+k4zePUjr6wyK4SLhQxGIcdZBdYUNw5iDQ58KqrsqECrwc9sTBo+VgQjCBl1kSNlBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6F9BD37307; Thu, 21 Mar 2024 11:52:47 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A855013976; Thu, 21 Mar 2024 11:52:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +W1lJo4f/GVjOgAAD6G6ig (envelope-from ); Thu, 21 Mar 2024 11:52:46 +0000 Date: Thu, 21 Mar 2024 12:54:08 +0100 From: Oscar Salvador To: Vlastimil Babka Cc: Matthew Wilcox , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Marco Elver , Andrey Konovalov , Alexander Potapenko , Tetsuo Handa Subject: Re: [PATCH v2 2/2] mm,page_owner: Fix accounting of pages when migrating Message-ID: References: <20240319183212.17156-1-osalvador@suse.de> <20240319183212.17156-3-osalvador@suse.de> 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: X-Spam-Level: Authentication-Results: smtp-out1.suse.de; none X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: 6F9BD37307 X-Spam-Flag: NO On Thu, Mar 21, 2024 at 12:20:24PM +0100, Vlastimil Babka wrote: > Understood, but migration is kinda heavy and non-fast-path operation already > so the extra lookup wouldn't be in a critical fast path. Ok, you convinced me, let us save that memory. > When I mean is we have __set_page_owner_handle() setting up everything for > tail pages and then we have __folio_copy_owner updating only the head page, > so this will create kinda a mixed up information. Which might not be an > issue as __folio_copy_owner() should mean it's a proper folio thus compound > page thus nobody ever will check those mismatched tail pages... Maybe we > could adjust __set_page_owner_handle() to skip tail pages for compound > pages as well and unify this, and tail pages would be only setup for those > weird high-order non-compound pages so that the odd case in __free_pages() > works? > > Or maybe page_owner is considered debugging functionality enough so it might > be worth having the redundant data in tail pages in case something goes > wrong. But either way now it seems we're not doing it consistently. So we basically have two options here, 1) is to also update tail pages in __folio_copy_owner, and 2) is to follow __folio_copy_owner example and skip tail pages in __set_page_owner. The thing is, going with 2) might mean, as you pointed out, that if something goes wrong we lose the information for those pages as page_owner does not have a record for them. OTOH, would that information be really useful? Sure we could see the stack, but AFAICS not even the migrate_reason would be recorded in those tail pages, which means that if they are migrated and freed, we would only see that they were freed. (the free stack would point to the migrate code though, so that is a hint). Not really sure which path to take here, skipping tail pages would be less of a complexity but at a risk of loosing information. Anyway, let me first tackle the issue at hand here, and then I will think more about that. Thanks! -- Oscar Salvador SUSE Labs