Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5580502ioo; Wed, 1 Jun 2022 08:17:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKM6Jiw0EBQkwnMSAM9XyOrJrwZ8B7zmjnxPZ8K/Rasecd8AKA2Q5tvouvzdA+FYJdD5FZ X-Received: by 2002:a17:90a:d583:b0:1e2:69bb:d701 with SMTP id v3-20020a17090ad58300b001e269bbd701mr2032pju.120.1654096650054; Wed, 01 Jun 2022 08:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654096650; cv=none; d=google.com; s=arc-20160816; b=QkipXQ7jeAcAAv+k1fwL6MxG5gr+IabHZvRpp4WN+5CAh8Sy1b+G3uslAkzBDBcZMB VsjaukHMxupYgOXcNKEsvrv3DFtneII8xEQhzm6sAbnK7srm6iFuA9GuACICbrQ14sAL lW5/yRLvBe2jQ4EzZJTp3TvDf3dVnrtvB6z6+s+dhxIIafuVH3b09TWHvXdtmvcp0uFS gfII3KUohCJLGLcsFrYIex+Ayk64W46imMEQ9F0swEhHDJSfxhL6hGS34Sl3q9sYtQRD I1lBL7QVc581Ddim9r3EtAR10mZQRrvg0B6hssyrgCfBNLqYzCgHWr/HtuKYZwOKUY7j jx9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=9Holi8WFcRRs2SBumcgZOpppBJDzx0jCIMI4rlCkjmY=; b=O4/7EW9vjbUWQA2x+cL7hthseVuB2VowDYuLsR/UGtXNwyisgo5oO5lJKhF/pBKMf1 BRCbGJbJvrHSTxZtw2j4HjAmWPHYlTBJhO3LSq45SPdbTLzAy06WDrZh+erm99cVcu1N xZAzriZkS441FOpJm/sWwns9o9kJQlx6aHe1en+lmOyqvWvbqSzyDt0RZ5B0sCeunyFi gP6G3UlTzEriWd+I1BEO3T/GRkSAKdBgyYieCX8XasIsms1Prmir1pfwLXfgsdORSAbz WeHDR2k7Mvrx+Qwfep2oiWh/JI0vq41FRG+Qdf1ydWXnYaQEkZsoGmGYtek4XkecvHRI E33A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=oY0WVqHG; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=SP3kEsYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg10-20020a1709028e8a00b0016403c5eaa2si2473284plb.28.2022.06.01.08.17.11; Wed, 01 Jun 2022 08:17:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=oY0WVqHG; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=SP3kEsYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244980AbiEaI4l (ORCPT + 99 others); Tue, 31 May 2022 04:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233830AbiEaI4i (ORCPT ); Tue, 31 May 2022 04:56:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D87938FFB6 for ; Tue, 31 May 2022 01:56:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 86D2C1F975; Tue, 31 May 2022 08:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1653987394; 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=9Holi8WFcRRs2SBumcgZOpppBJDzx0jCIMI4rlCkjmY=; b=oY0WVqHGEUGdSpZh8ADVsO97wS/tQ1QCcyzbZEedjjQBJrQ1kE+xvyqQciIgCeSl/Tvf2e R7KXu9YZNaHIcF/w/iLIR5K6prHInRH1xT2/KnIUSpIb3RIdobCQT51JVrSAgCw3SrBa2X 6Q6N1BITChk+32ujBPFPDwbGM33jxbU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1653987394; 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=9Holi8WFcRRs2SBumcgZOpppBJDzx0jCIMI4rlCkjmY=; b=SP3kEsYuGUsw8sbI7sgdD++c7pUR9sMzWN2FQ/cUS6Oj+2E6nI5YSaZaFCgA4h93RPEDc/ Hy4y+YO8bQGbH4AQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 935C513AA2; Tue, 31 May 2022 08:56:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RuIyIUHYlWLOfwAAMHmgww (envelope-from ); Tue, 31 May 2022 08:56:33 +0000 Date: Tue, 31 May 2022 10:56:31 +0200 From: Oscar Salvador To: Zi Yan Cc: Andrew Morton , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qian Cai , Vlastimil Babka , Mel Gorman , Eric Ren , Mike Rapoport , Christophe Leroy , Anshuman Khandual Subject: Re: [PATCH] mm: page_isolation: use compound_nr() correctly in isolate_single_pageblock() Message-ID: References: <20220531024450.2498431-1-zi.yan@sent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220531024450.2498431-1-zi.yan@sent.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 10:44:50PM -0400, Zi Yan wrote: > From: Zi Yan > > When compound_nr(page) was used, page was not guaranteed to be the head > of the compound page and it could cause an infinite loop. Fix it by calling > it on the head page. > > Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity") > Reported-by: Anshuman Khandual > Link: https://lore.kernel.org/linux-mm/20220530115027.123341-1-anshuman.khandual@arm.com/ > Signed-off-by: Zi Yan Reviewed-by: Oscar Salvador > --- > mm/page_isolation.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/page_isolation.c b/mm/page_isolation.c > index 6021f8444b5a..d200d41ad0d3 100644 > --- a/mm/page_isolation.c > +++ b/mm/page_isolation.c > @@ -385,9 +385,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, > * above do the rest. If migration is not possible, just fail. > */ > if (PageCompound(page)) { > - unsigned long nr_pages = compound_nr(page); > struct page *head = compound_head(page); > unsigned long head_pfn = page_to_pfn(head); > + unsigned long nr_pages = compound_nr(head); > > if (head_pfn + nr_pages <= boundary_pfn) { > pfn = head_pfn + nr_pages; > -- > 2.35.1 > -- Oscar Salvador SUSE Labs