From patchwork Wed Jan 9 11:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10753869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF49213B5 for ; Wed, 9 Jan 2019 11:13:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACA8F28925 for ; Wed, 9 Jan 2019 11:13:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94386289E9; Wed, 9 Jan 2019 11:13:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3162228925 for ; Wed, 9 Jan 2019 11:13:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 526678E00A2; Wed, 9 Jan 2019 06:13:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4D6968E0038; Wed, 9 Jan 2019 06:13:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3ECA08E00A2; Wed, 9 Jan 2019 06:13:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id E1F5F8E0038 for ; Wed, 9 Jan 2019 06:13:47 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id y35so2829059edb.5 for ; Wed, 09 Jan 2019 03:13:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:date:from:to :cc:subject:message-id:references:mime-version:content-disposition :in-reply-to:user-agent; bh=yiyd8gDE0xjyrvZTEsSrfqnm7Y6dP/qLYChxLkB7ScE=; b=LGuV2k+yEDwJNdQdOH8jMJEgdOAWKJSMO8PgHrO77GGA8hafI3kbDsPHalfa5m6ywL HKemV2X1+z798uY+ijH9lggEdyTCqBn02VQ0DnNsAodVRUHkb1rbthZxfD41xWkCgu1T glVdbO6cid18JdyB5ctiHEbuhklb84eSHzUCeEJ9K30aQbbkm6F1OwLknje4XUsWR4P4 zUjKtAS5oUC3AdpwOMSgKu1h/aGlpCS6/xFnlgFYdgn5RsrLhS+9WPoDZpMuwRum4qh4 uNGHYSoaKmao9cnrV5KgOLBETRJQVZ/dDFjHjlU1H8jBSfImXFQdxzA2/r6KJ2ZUG1UU YrUg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AJcUukdFGVoNR47H0qWQfgjD8BhXlDGrMF7SPqcBwNDx/ebOmA5bIDgL S22UBHaQ2aL/uryzSz35/4lIq5bNsRyjpYcKl6GDO6CJCh3Ws6kzo1Hd13dedJIz3WmF9XUm8DM gXT5mz3LLtg0zqHfhQMFM+Cl0YXpyKZu/MBIGDPAmlTY7AaQur6tmGhKklX8xqHoqHA== X-Received: by 2002:a17:906:4e4d:: with SMTP id g13-v6mr4969933ejw.248.1547032427333; Wed, 09 Jan 2019 03:13:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN63BhAHeiXibDidOhuv5ONAGofQmU0k2soV82KXsnvvstNm1Z1yDNgLmo3MigibEfir+Lu3 X-Received: by 2002:a17:906:4e4d:: with SMTP id g13-v6mr4969895ejw.248.1547032426416; Wed, 09 Jan 2019 03:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547032426; cv=none; d=google.com; s=arc-20160816; b=Tme2+sqXhd/ItheL3xy23DjJvFiXzchNrv+SnqOROqIgXwK4cE7n1FyRT8HecEMQYx LXRCdHhVzQx0aSkvm9wnzCMTxxbRyMTLJJUWWxkz+b818aa/xibL8UBZpYEgkOhiOo6+ ynSk4frnCEwcb+in7FAJr95Vb145dz9DC4eNJI61dZJ0X00FCXZl6kKCb/f2QsfIU9ga EigwcjUw0PLboJ7DE+f0RC+VrazMSGocAJrS0qE95x5avnPrkAG2Dc0a1LzOMZUtwXBW BbNI1ISo7z1xggUrLgwMxC9T0ellnQadhrl+Eljp05zSgT+MYUsfUOc6+auXDvZWE/Y6 kzdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date; bh=yiyd8gDE0xjyrvZTEsSrfqnm7Y6dP/qLYChxLkB7ScE=; b=AL1+VTMmBrA9VUq4PP4jxBctvTRFjUMA6jhLtsG75qT9JPTCCijLFugo1813vEqohS zKo2R4U+fVOLJH7Ux6liio0pNFmRlTAVs2Bogx/IHo0RC5382Pslj7+fpPn9CfIvtyj8 kWrcZcVtI5lhbzpUw64hR/6JEj5WkU0xwETpXGZItLgPmu6CVRp9z78tSDFAXp1BJTp7 c6rZrVuqkD13QTQarGHh90w56imAzTQT8K24mrx95RtPTk0+4T6SOwDHUgBotc5m9wmr gNkLeJdbCQU2HGzDSq6+Cw16dw0feh88CSY2OWPOVklyJkWpqkDLdA+H6X+DSAs8bD8w oSWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp08.blacknight.com (outbound-smtp08.blacknight.com. [46.22.139.13]) by mx.google.com with ESMTPS id z24-v6si1223070ejl.68.2019.01.09.03.13.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 03:13:46 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) client-ip=46.22.139.13; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp08.blacknight.com (Postfix) with ESMTPS id ED7251C28B7 for ; Wed, 9 Jan 2019 11:13:45 +0000 (GMT) Received: (qmail 4583 invoked from network); 9 Jan 2019 11:13:45 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.229.96]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 9 Jan 2019 11:13:45 -0000 Date: Wed, 9 Jan 2019 11:13:44 +0000 From: Mel Gorman To: Andrew Morton Cc: David Rientjes , Andrea Arcangeli , Vlastimil Babka , ying.huang@intel.com, kirill@shutemov.name, Linux-MM , Linux List Kernel Mailing Subject: [PATCH] mm, compaction: Use free lists to quickly locate a migration target -fix Message-ID: <20190109111344.GU31517@techsingularity.net> References: <20190104125011.16071-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190104125011.16071-1-mgorman@techsingularity.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Full compaction of a node passes in negative orders which can lead to array boundary issues. While it could be addressed in the control flow of the primary loop, it would be fragile so explicitly check for the condition. This is a fix for the mmotm patch broken-out/mm-compaction-use-free-lists-to-quickly-locate-a-migration-target.patch Signed-off-by: Mel Gorman Signed-off-by: Mel Gorman --- mm/compaction.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 9438f0564ed5..167ad0f5c2fe 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1206,6 +1206,10 @@ fast_isolate_freepages(struct compact_control *cc) bool scan_start = false; int order; + /* Full compaction passes in a negative order */ + if (order <= 0) + return cc->free_pfn; + /* * If starting the scan, use a deeper search and use the highest * PFN found if a suitable one is not found.