From patchwork Tue Jan 10 13:36:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13095166 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 7AD81C54EBC for ; Tue, 10 Jan 2023 13:36:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DCFF8E0008; Tue, 10 Jan 2023 08:36:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 267048E0007; Tue, 10 Jan 2023 08:36:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12CA38E0008; Tue, 10 Jan 2023 08:36:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DF37B8E0006 for ; Tue, 10 Jan 2023 08:36:36 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AA598AD456 for ; Tue, 10 Jan 2023 13:36:36 +0000 (UTC) X-FDA: 80338989192.20.BBFF070 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf24.hostedemail.com (Postfix) with ESMTP id BBE7C180012 for ; Tue, 10 Jan 2023 13:36:34 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf24.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673357795; a=rsa-sha256; cv=none; b=mGydrfNX70j1eTQ8+s+jxt0AkFAhS9pVvkvO2dwVNiYiJ14p4/VvTn29++GHNcpmhHJuzD 7Iabb585snjVoqiKf1kmU7c5N4Br/uJm36K0lAmBoLlOV0FHSXqhut3le6fnK+xgR7BYj6 9l4GPWJAdzPDddslbqTjEDja8GUiA18= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf24.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673357795; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aUz5wuXddfVU8PbRGdBJ86wOUc4sRQaM/iFEVaa7T9s=; b=RGJt4hwC4UPZy077SW5xqZF1lSXMCWpGsDUiYNVD+AuCwQ2CGhsidfTi7BXVw2Znmilkcb HotW9CY3mGYYSkT63ea+S9tqTkoQuLKrpLhaQqOFe6i0A8LIh0x2P5D3ul7ozuEOEBBFfy fiRlxWmNbJ6Tswu5JprrAlEr9mVbYXI= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJUhjw_1673357790; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJUhjw_1673357790) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:30 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] mm: compaction: Avoid fragmentation score calculation for empty zones Date: Tue, 10 Jan 2023 21:36:22 +0800 Message-Id: <100331ad9d274a9725e687b00d85d75d7e4a17c7.1673342761.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BBE7C180012 X-Stat-Signature: qxjon6jj135n4rr83go3eab37f7rnsci X-HE-Tag: 1673357794-212038 X-HE-Meta: U2FsdGVkX1+kULE/yG70kFjAeGim3Dgkchp7f1OA2S8U+tF5Eg4tvPiV3mbbIlHbn8rfzW4qxCcdu4+b2O2pMiDr3G/D2ZmF41ergHwdtHzgI9YKFIBEs2sOlGCp/PIhxIVYt6vvZyOB24GT4zbaumIJX/dKMeQ+CokGj8nVBuT5joIaHchfkP6oByfPe1IFiM7S6/0a1Dxku25FaAvte7wcCxOThQkTtdYrTc+9QwpEImATKBLEQdqrn/J7e7vztvYexKzUd/qSRNlo/MopDZVM18gA7DzZtkaRq9VtgJ+gMBG/bYkleQwCG1+Nsw/mPhpxCsTN0/CCac9Z2QX9c+M59K6t9v9MQ+NaS1JsDLx989svY/cnrfbHU1pALLzy2lJZZo5OaTOoZTbng5mwW7RhFUKk0DnrSfOZgQcDwGhvZkiIWKUCBVLanZhKmy5C6upPLgQLPFX0ulAyzvMzm6hcVJvUaBue18YwwsLff0o/xNwI4TfRcMkC+vGqGjhEyksk7mKXq5/Kr35LPFZMKfANZXvbBATpl+spX9PRT05cTjT4SGkVXxhJsVUWGfkU1gC2FqbFMMuyjFqZX/HoqeET0sh1ERB6cR+sXQpR+SGzFcMz7QpPrIRzDZxDa0aIt8ZWcAzxceN1aCuDZXyY1PUGCEO/FBMvS4OPUGclLWTxYpLGhrtV4oXO8S44zDP8VtpgcyG+Jwf005AJXz25ZpJnYjZdtU6b1fbdz30qNBru8AilFPN6rFezgQIc+IvxelHZvp+lniYssRHzOCf+leugqmS9gJ5rQfZQ2OkaYz+QwyU20qU9APCENrZUUoJfLhztkopXuAI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.032285, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: There is no need to calculate the fragmentation score for empty zones. Signed-off-by: Baolin Wang --- mm/compaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 0fd6c81a7809..b758b00a4885 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2025,6 +2025,8 @@ static unsigned int fragmentation_score_node(pg_data_t *pgdat) struct zone *zone; zone = &pgdat->node_zones[zoneid]; + if (!populated_zone(zone)) + continue; score += fragmentation_score_zone_weighted(zone); }