From mboxrd@z Thu Jan 1 00:00:00 1970 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 7D7AD2BF3F3 for ; Thu, 14 May 2026 08:00:21 +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=1778745622; cv=none; b=szvuUBmq2IGTycTom1c2jjFh5J0PQdfrKQyt/jerVRcAlY2hTqYkmBkK8GtV6jFr/vaLKbRho/hNyRsWex6Xs46tWYzFDY6wpapXstKtp7sv0Dk7GKhXO83v/xXiDffBJ6ug7T6+GCLGDKSS3+HZn47Z06EtWonWCI32Wzy8AFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778745622; c=relaxed/simple; bh=p11Vu5cG2Zy5pBS2zV8xI7JGe5bqQvWxdU/GTsR3liE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u08bnsRu2ZA8gOdAUKqLjVDSgITe6avy0Yf5EnkCq9Y7yKv8EvghtdVg2kxCYlgoxv15WNiaxwViyZ5tU01569QkUP/RwKHJ052cv495kkN47KdXy2X4LXLol4dT5Z9ZaPx+QP1jPTqvtXlyECzH6MvwmVAdNKHMDqHITTJpBqM= 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; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=CJLjzcwG; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=C4248gcx; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=CJLjzcwG; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=C4248gcx; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="CJLjzcwG"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="C4248gcx"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="CJLjzcwG"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="C4248gcx" Received: from imap1.dmz-prg2.suse.org (unknown [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 B0A575E0B4; Thu, 14 May 2026 08:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778745619; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0ApyV1SJgz5wtbwoXbn/VnkSAGGIM5s57P85+2beKro=; b=CJLjzcwGlCsOVB9un6xLW22kKcw6V4Xlum6RMNosJGw32EAzNkqaZ0dXBputXg8joCGJh5 ZC1jpkQXSTxpbM6WBhRM4oeLo+fYzd66yI5ebrozqIG9PAWcPh+1jwQnrrgvtShLJAV6m0 iztuO6FRDH7X+dSyQAMxzhaR+0Yiy8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778745619; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0ApyV1SJgz5wtbwoXbn/VnkSAGGIM5s57P85+2beKro=; b=C4248gcxLcOZ45VZ6Xk2Ku4O2ABnN9dD5IGpb7ZAPZEdfu+e2hfvYKSUMmGYh5vpD4fT12 zLyXzyaJCm0GMMAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778745619; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0ApyV1SJgz5wtbwoXbn/VnkSAGGIM5s57P85+2beKro=; b=CJLjzcwGlCsOVB9un6xLW22kKcw6V4Xlum6RMNosJGw32EAzNkqaZ0dXBputXg8joCGJh5 ZC1jpkQXSTxpbM6WBhRM4oeLo+fYzd66yI5ebrozqIG9PAWcPh+1jwQnrrgvtShLJAV6m0 iztuO6FRDH7X+dSyQAMxzhaR+0Yiy8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778745619; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0ApyV1SJgz5wtbwoXbn/VnkSAGGIM5s57P85+2beKro=; b=C4248gcxLcOZ45VZ6Xk2Ku4O2ABnN9dD5IGpb7ZAPZEdfu+e2hfvYKSUMmGYh5vpD4fT12 zLyXzyaJCm0GMMAA== 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 D86D3593AA; Thu, 14 May 2026 08:00:18 +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 4xHQMhKBBWr/DQAAD6G6ig (envelope-from ); Thu, 14 May 2026 08:00:18 +0000 Date: Thu, 14 May 2026 10:00:17 +0200 From: Oscar Salvador To: Muchun Song Cc: Andrew Morton , David Hildenbrand , Muchun Song , Michael Ellerman , Madhavan Srinivasan , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , Ackerley Tng , Frank van der Linden , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 03/69] powerpc/mm: Fix wrong addr_pfn tracking in compound vmemmap population Message-ID: References: <20260513130542.35604-1-songmuchun@bytedance.com> <20260513130542.35604-4-songmuchun@bytedance.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: <20260513130542.35604-4-songmuchun@bytedance.com> X-Spam-Level: X-Spamd-Result: default: False [-8.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[21]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[linux-foundation.org,kernel.org,linux.dev,ellerman.id.au,linux.ibm.com,oracle.com,google.com,suse.com,gmail.com,kvack.org,lists.ozlabs.org,vger.kernel.org]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,bytedance.com:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Flag: NO X-Spam-Score: -8.30 On Wed, May 13, 2026 at 09:04:31PM +0800, Muchun Song wrote: > vmemmap_populate_compound_pages() uses addr_pfn to determine the PFN > offset within a compound page and to decide whether the current > vmemmap slot should be populated as a head page mapping or should reuse > a tail page mapping. > > However, addr_pfn is advanced manually in parallel with addr. The loop > itself progresses in vmemmap address space, so each PAGE_SIZE step in > addr covers PAGE_SIZE / sizeof(struct page) struct page slots. Since > addr_pfn is compared against nr_pages in data-PFN units, it should > advance by the same number of PFNs. The existing manual increments do > not match that and therefore do not reliably track the PFN > corresponding to the current addr. > > As a result, pfn_offset can be computed from the wrong PFN and the code > can make the head/tail decision for the wrong compound-page position. > > Fix this by deriving addr_pfn directly from the current vmemmap address > instead of carrying it as loop state. > > Fixes: f2b79c0d7968 ("powerpc/book3s64/radix: add support for vmemmap optimization for radix") > Signed-off-by: Muchun Song Acked-by: Oscar Salvador -- Oscar Salvador SUSE Labs