Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3275461imw; Mon, 11 Jul 2022 05:41:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tBCRrP0+B1wi0BVimPbyaj3a3G7JBRY35n+8RkUrma5BFilDaLT+GVpxTzOmlx3HYofZSz X-Received: by 2002:a63:d341:0:b0:412:ace8:b0ed with SMTP id u1-20020a63d341000000b00412ace8b0edmr15530297pgi.169.1657543263793; Mon, 11 Jul 2022 05:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657543263; cv=none; d=google.com; s=arc-20160816; b=EO/kISD1tAt01DMVhEjWubBMAa9COOc1rDhF64r10GoFaHKp/lI8sXqgW9E81f6wQC 9DYoQL4HhDVsQfUbaQk6TQrIthyWFRe0Pz6jnu1Fn7BTK40E+EmYHw54Ej+x8mcPMeo2 SRdJXDppmUWXIQHIroucmoT0a/TJRjtzQpLqrcRMKOj+4TEAUzn7CTHZ/YEC56IyGeXH hL1fmD8U4vJfsSaYQd64O9/bcnAtXnxZHZdBuRG2N2DrXFyu/Q6VP/12ifi2Xr6Cxqwq DJvYcb/iPbffFBYLOVPNPaTYfZGhVeZHEYoBgelqCDibxgM2eeZ2tYMNjLhlNKKLSrdJ z+rg== 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=xU9MoVznrIVIBMvPbpouJup20DYgj7sfYLi8h4sbB5s=; b=Q4iB3b9K+G9L4WItk8EFTHw7aX35p3I9FkqhVgewh1VonSvOE8zKl10nv0P9jRFQtf AR5V7V62mfVxcOBpZa8DL0UywGItwEwcW031eHAljKj4ufbOyhnBr29/JNDb/4For9Iz JRaqw2voaAzmdP52QYbf7QFI8JFTlukIWTgjBkXwp26ulnUTKZ9Z/JqhWcrW/eD0KR0/ YQnhAIoMVdGwiAzEp13Cdbv/h8HOVvU/xVOdo936e5F1XQQkTXOZeGPy77SQYKVaK2Bg xyHRsbYafOiH0wZDH8caQMVYrXdz8fgRdP5TEV6slBVlWA1DJACBk0KvMt677g0CW7Am 21yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=EMAQ3C2J; dkim=neutral (no key) header.i=@suse.de; 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 g187-20020a636bc4000000b00411acc4821bsi11013636pgc.655.2022.07.11.05.40.51; Mon, 11 Jul 2022 05:41:03 -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=EMAQ3C2J; dkim=neutral (no key) header.i=@suse.de; 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 S231713AbiGKMkQ (ORCPT + 99 others); Mon, 11 Jul 2022 08:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231726AbiGKMkA (ORCPT ); Mon, 11 Jul 2022 08:40:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D742D60699 for ; Mon, 11 Jul 2022 05:39:26 -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 93FEB1FE0E; Mon, 11 Jul 2022 12:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657543165; 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=xU9MoVznrIVIBMvPbpouJup20DYgj7sfYLi8h4sbB5s=; b=EMAQ3C2JXSsXt7UTY59BN+sxHzMvUmEmfhJX48BwTe52lDfNkJMBJG35xEYYdXbRfEoOZv rDwqvquUfYGBAnwFiuwbP6BmZVceJ2CvLY1+G+XDCEmm8W+hLmr4B1m8pgS+bg2+GWlxBW xANGly8JM0mXyohItIg/HEXMqV7qhjg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657543165; 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=xU9MoVznrIVIBMvPbpouJup20DYgj7sfYLi8h4sbB5s=; b=RTNcHc55/ON+DdiQGrxn6/rnDtRSUGX/6e1QVwxJ6oDjc/qZuNzQzzZgliezbz2XyWSbzG Ne7EI7dchnSs+VDw== 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 6956313524; Mon, 11 Jul 2022 12:39:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LniXGP0ZzGL3FwAAMHmgww (envelope-from ); Mon, 11 Jul 2022 12:39:25 +0000 Date: Mon, 11 Jul 2022 14:39:24 +0200 From: Oscar Salvador To: Huang Ying Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baolin Wang , Zi Yan , Yang Shi Subject: Re: [PATCH -V2 6/7] migrate_pages(): fix failure counting for THP splitting Message-ID: References: <20220711084948.274787-1-ying.huang@intel.com> <20220711084948.274787-7-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220711084948.274787-7-ying.huang@intel.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, Jul 11, 2022 at 04:49:47PM +0800, Huang Ying wrote: > If THP is failed to be migrated, it may be split and retry. But after > splitting, the head page will be left in "from" list, although THP > migration failure has been counted already. If the head page is > failed to be migrated too, the failure will be counted twice > incorrectly. So this is fixed in this patch via moving the head page > of THP after splitting to "thp_split_pages" too. > > Signed-off-by: "Huang, Ying" > Fixes: 5984fabb6e82 ("mm: move_pages: report the number of non-attempted pages") > Reviewed-by: Baolin Wang > Cc: Zi Yan > Cc: Yang Shi Reviewed-by: Oscar Salvador > --- > mm/migrate.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 8cce73b7c046..557708ce13a1 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1306,6 +1306,8 @@ static inline int try_split_thp(struct page *page, struct list_head *split_pages > lock_page(page); > rc = split_huge_page_to_list(page, split_pages); > unlock_page(page); > + if (!rc) > + list_move_tail(&page->lru, split_pages); > > return rc; > } > @@ -1365,7 +1367,6 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > thp_retry = 0; > > list_for_each_entry_safe(page, page2, from, lru) { > -retry: > /* > * THP statistics is based on the source huge page. > * Capture required information that might get lost > @@ -1412,7 +1413,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > nr_thp_failed++; > if (!try_split_thp(page, &thp_split_pages)) { > nr_thp_split++; > - goto retry; > + break; > } > /* Hugetlb migration is unsupported */ > } else if (!no_subpage_counting) { > @@ -1432,7 +1433,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > /* THP NUMA faulting doesn't split THP to retry. */ > if (!nosplit && !try_split_thp(page, &thp_split_pages)) { > nr_thp_split++; > - goto retry; > + break; > } > } else if (!no_subpage_counting) { > nr_failed++; > -- > 2.30.2 > > -- Oscar Salvador SUSE Labs