Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp47431ybl; Tue, 20 Aug 2019 15:22:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwESttCBAupEjgFw+qk9EWY/nVndDha2I+ugBP+jpzoECXvb5zKXGfliak86PWpJm6BFslF X-Received: by 2002:a65:60d2:: with SMTP id r18mr26046599pgv.71.1566339720299; Tue, 20 Aug 2019 15:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566339720; cv=none; d=google.com; s=arc-20160816; b=jP7PVPxEcKwemc0gdfZFN54PEwFswV30fPVZPnSJ6ZDovxbA8u/ByCphrcmTjANcvG hTBhZT4tj8hTUg+vs14UCdSly7+Yx06ugeOSOBZMA0h4yhg4Z/Ghmm2f8U2dPfH0Epdt vxr629iDmGjNwmcKsdM1MBVX3IutsnTy/Uzns/iJXbe8vo75/24LB085zZBJEhzlHwdF m5j5PPdF4v0bVs8sxEXkusPEm8a1nHVSVW3WO9rQ4s4BFL+EB1Ooq4xEB3p5ymBM/jXk q4daNTXvfmUl62dvFzLd2M00OxkU75utsyzXIMz0k9tvpi3U9797kZVzJRntBTH13umf 7LBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Z6ZVviRtuyf2TUYASfKOwbPfalJnz3NoFwMLit9B6E0=; b=XZ7NioKHAy3gKTbwa0Q7U4EMx0SPzm0f7cthURD25B0Rsy4xJmCA0dY65POmLOU5hw wTBUPuyqAwRIUR2FHFtFM+RFqsnt7euTGOqv5CdJwi/w5pnvnj1Gf3PRJ8ormct2Qw3c wvkeKgV8VsntonbcAw2T+Nf8eNAVkWlXRH6vz4BV09/0r9ikGYFPwQQ3jh1fXXsm3Twf 6C9lbYZ7EkIFT8lzzT8OdvPfBeKLDRspjPFnNvcR6KcPEWI9nuDlFwPo5xm7YN61RRmk VvmRwuhmBQzs1NM2F6nM8clU9BZ2iWfuIkb49eDFTO5yS7Lci+0hyOKsCrbqAVEctMGD BR5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=g1gjiaVs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f22si5751985plj.247.2019.08.20.15.21.45; Tue, 20 Aug 2019 15:22:00 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=g1gjiaVs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730858AbfHTWUt (ORCPT + 99 others); Tue, 20 Aug 2019 18:20:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34228 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729887AbfHTWUt (ORCPT ); Tue, 20 Aug 2019 18:20:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Z6ZVviRtuyf2TUYASfKOwbPfalJnz3NoFwMLit9B6E0=; b=g1gjiaVs4Puj+/mhPMATNXkaR jmIWbDo7zqvkJou0f1g3xQOpEFZgfod/Jw1CHF5ZD13xXs+n2SOiCDmUlT5CrcLMUcuqvdcNbhw8Z rCgkST4EiwHLwvk12cwyB/XXpG1tQCjq/tjxIYM4GiGGqIr+m8VaAn2s6u8yPBqr/XLZkEZsKrH/W AB4UXVg4DI2ItaU0UB7kGsg7xbGoPNSKMc+Qr3CqeBGdxmSzPfoTTGrqG1aVuLP3jAETItkT03aRz fYrDVMKXJg7H13nUA04J8WLFC+EOuCHwzAn4bHR4cajke+Cg0IcBGGf6yeihC3UwAgthgggBEJh1H rLOuXqtXA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1i0CUV-0002Ar-Az; Tue, 20 Aug 2019 22:20:35 +0000 Date: Tue, 20 Aug 2019 15:20:35 -0700 From: Matthew Wilcox To: Nitin Gupta Cc: akpm@linux-foundation.org, vbabka@suse.cz, mgorman@techsingularity.net, mhocko@suse.com, dan.j.williams@intel.com, Yu Zhao , Qian Cai , Andrey Ryabinin , Roman Gushchin , Greg Kroah-Hartman , Kees Cook , Jann Horn , Johannes Weiner , Arun KS , Janne Huttunen , Konstantin Khlebnikov , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC] mm: Proactive compaction Message-ID: <20190820222035.GC4949@bombadil.infradead.org> References: <20190816214413.15006-1-nigupta@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190816214413.15006-1-nigupta@nvidia.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 02:43:30PM -0700, Nitin Gupta wrote: > Testing done (on x86): > - Set /sys/kernel/mm/compaction/order-9/extfrag_{low,high} = {25, 30} > respectively. > - Use a test program to fragment memory: the program allocates all memory > and then for each 2M aligned section, frees 3/4 of base pages using > munmap. > - kcompactd0 detects fragmentation for order-9 > extfrag_high and starts > compaction till extfrag < extfrag_low for order-9. Your test program is a good idea, but I worry it may produce unrealistically optimistic outcomes. Page cache is readily reclaimable, so you're setting up a situation where 2MB pages can once again be produced. How about this: One program which creates a file several times the size of memory (or several files which total the same amount). Then read the file(s). Maybe by mmap(), and just do nice easy sequential accesses. A second program which causes slab allocations. eg for (;;) { for (i = 0; i < n * 1000 * 1000; i++) { char fname[64]; sprintf(fname, "/tmp/missing.%d", i); open(fname, O_RDWR); } } The first program should thrash the pagecache, causing pages to continuously be allocated, reclaimed and freed. The second will create millions of dentries, causing the slab allocator to allocate a lot of order-0 pages which are harder to free. If you really want to make it work hard, mix in opening some files whihc actually exist, preventing the pages which contain those dentries from being evicted. This feels like it's simulating a more normal workload than your test. What do you think?