Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp126885img; Wed, 27 Feb 2019 18:20:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZQMi5oEs/cmLurrRy3K2RHGCasc1fgzkRjr/NO6OOrOpLROQei3PL/FpGmhRq3uAiK1NNA X-Received: by 2002:a65:4844:: with SMTP id i4mr5860812pgs.347.1551320444813; Wed, 27 Feb 2019 18:20:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551320444; cv=none; d=google.com; s=arc-20160816; b=qm5wgIT7EkIOKxEt/Mnkt/W0JWLnRrz0UbT1JgZ6argWFkEUm/PyVwvxIc/6/aDeNO j1eRKKq1QVMI6wEI/7cqGl83jyi12gU0n/ddGKdj5E8PI2fbqCxSteYNZf7yifHMvDri LaxAdumrG3xd0A4dfMl31qGK/7t1puYknwLju5aTKHo6QHwbtc01OsxhtfA+994L2/oc wuuYzi5I+v5sZ/VOkt2A/vqBOLTHLF0g1hiZ8rpbm0mE1yqj+egBw59ZveQCB73P/G0E WWA5t7ttr/6ljZ6Umeq2b6NkVuMSuGuwiRAqxnGDxNnKxGJoT8cu6v0Wfu40h/jUp10J LhYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=k81wrdCLr8miUfd7ykySbkmm4/3UN7J8vKeD0uvtXrQ=; b=MEUHreDFRBXJEA7BlMm/NCiohdUO0eyimZKFPpyHX2iZvrFzCWYNiyAmLY8b8L8URj 5sD9zvCCAf4ygxPWpf4ZS7fuJDARrBgmA7e2W6JS7Hj8odYcSo0kmSyG6W+LQyKj3loI C4rbQTd9y6Gke1a2zhzk/VkBO/FqUgozFr6y0BVKASyWqHA7cM/RNt0ZQcL3n5Q0Up+c Hk0hLKCuH1/mCYOx11WD/RApgHCQf844HV5434ub2n+fKIhMPGotfa3uw1QBpFSw6VgT lAZrmGHmDEAljhrw4FQpx/smD3j4UtIx9hv6dgGFPPF47/dEv9fLNdjnAFB5nrHV/6TC Y+zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ct9si2332017plb.341.2019.02.27.18.20.29; Wed, 27 Feb 2019 18:20:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730924AbfB1CTj (ORCPT + 99 others); Wed, 27 Feb 2019 21:19:39 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:34364 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730702AbfB1CSu (ORCPT ); Wed, 27 Feb 2019 21:18:50 -0500 Received: by mail-qk1-f193.google.com with SMTP id a15so11200201qkc.1 for ; Wed, 27 Feb 2019 18:18:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=k81wrdCLr8miUfd7ykySbkmm4/3UN7J8vKeD0uvtXrQ=; b=neDVS6yrDPB95YIXBwB/MdKL6Uosxp/tEiJbT2erCLFTWS6uu8TZ0WawRvr5NxuV2y kFIvUcdzCYiVuhUxxJKe+6pC27pfS+Gn5y9J/QGpZeGNaM87PgJ0VdtuPtE86V+uvTEC th4eH3edW+bKVmXjVEaGK/+zVZ1pvz7ltLxVdZdxZQltWyw4Db+zmq1E6K65inhRL8HX ebma8y+50kQ7VtkrAAo0wjLBcKfbCoOzoo0fFY/WXkixwpW9LRu3nAefPgfttyXCtlEn 4O/CROomykXmlHPSCDCzcjYhD5eNY9vDyqVXyt+HEQ10Z/AyX7WvvW0mtxWWyPLuCkK+ r0hw== X-Gm-Message-State: APjAAAVmFFPAtJG6yGqf4Z1P/L5NIJzbRsm4iRvnsQ3fRNeEh7To79Ba Qz2KZlDfjRkd3Yr3jMArX7Y= X-Received: by 2002:a37:e40f:: with SMTP id y15mr4725411qkf.230.1551320329706; Wed, 27 Feb 2019 18:18:49 -0800 (PST) Received: from localhost.localdomain (cpe-98-13-254-243.nyc.res.rr.com. [98.13.254.243]) by smtp.gmail.com with ESMTPSA id y21sm12048357qth.90.2019.02.27.18.18.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Feb 2019 18:18:48 -0800 (PST) From: Dennis Zhou To: Dennis Zhou , Tejun Heo , Christoph Lameter Cc: Vlad Buslov , kernel-team@fb.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/12] percpu: manage chunks based on contig_bits instead of free_bytes Date: Wed, 27 Feb 2019 21:18:31 -0500 Message-Id: <20190228021839.55779-5-dennis@kernel.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20190228021839.55779-1-dennis@kernel.org> References: <20190228021839.55779-1-dennis@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a chunk becomes fragmented, it can end up having a large number of small allocation areas free. The free_bytes sorting of chunks leads to unnecessary checking of chunks that cannot satisfy the allocation. Switch to contig_bits sorting to prevent scanning chunks that may not be able to service the allocation request. Signed-off-by: Dennis Zhou --- mm/percpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/percpu.c b/mm/percpu.c index b40112b2fc59..c996bcffbb2a 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -234,7 +234,7 @@ static int pcpu_chunk_slot(const struct pcpu_chunk *chunk) if (chunk->free_bytes < PCPU_MIN_ALLOC_SIZE || chunk->contig_bits == 0) return 0; - return pcpu_size_to_slot(chunk->free_bytes); + return pcpu_size_to_slot(chunk->contig_bits * PCPU_MIN_ALLOC_SIZE); } /* set the pointer to a chunk in a page struct */ -- 2.17.1