From patchwork Fri Nov 6 12:30:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11887055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4AE86A2 for ; Fri, 6 Nov 2020 12:30:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C3C12087E for ; Fri, 6 Nov 2020 12:30:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Rd5xXhJr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C3C12087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 36A5D6B005C; Fri, 6 Nov 2020 07:30:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 319E76B005D; Fri, 6 Nov 2020 07:30:45 -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 231676B0068; Fri, 6 Nov 2020 07:30:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by kanga.kvack.org (Postfix) with ESMTP id E83876B005C for ; Fri, 6 Nov 2020 07:30:44 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 920B4180AD815 for ; Fri, 6 Nov 2020 12:30:44 +0000 (UTC) X-FDA: 77453927208.29.tail95_101587e272d2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 73A4C180868EE for ; Fri, 6 Nov 2020 12:30:44 +0000 (UTC) X-Spam-Summary: 1,0,0,08b36996b336a699,d41d8cd98f00b204,willy@infradead.org,,RULES_HIT:41:69:355:379:541:800:960:966:967:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2859:2897:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3870:3871:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:4605:5007:6119:6261:6653:7903:8603:9025:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13845:13894:14096:14181:14394:14721:21080:21347:21451:21627:21740:21749:21811:21987:30029:30054,0,RBL:90.155.50.34:@infradead.org:.lbl8.mailshell.net-64.201.201.201 62.8.15.100;04y8q4nf5ethnuogdwze6c7o6kephop67gfarihy76yik8djj6bdkht1e78k7q6.k6fkceqh91xpax6hkp714jhmru99wo5zppd9k5k7zrb5938p1wetdq5iad6nkfa.q-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral, Custom_r X-HE-Tag: tail95_101587e272d2 X-Filterd-Recvd-Size: 4236 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Nov 2020 12:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=6tUINAMJjUdq6LPonn3cLBWKxJPktFDlylPf+keuUGY=; b=Rd5xXhJrZyFlBMKU+t+tU6YQBt DpB39P7+K4us9Xtob24m4tOMLG61acjJu8Hv08zmzE+LK1nRqxQ6q4HkjiPMg/SkNfhsWUQfAClH1 /aueSdDKNGP2/6iTeZ9VWx+0NzonkHyVeHbejiDmj1StBj1PjMCFqqhvlvwPwt8SWK7Fvt/ywbNV8 DVB9AQQ+rJepsrXGjz8SWa+PX9SfvZyEjqMDxsNAC2GijrUORkbDYCQ7iWaQvEGa3jkUICESEcVcI s8n/ojnT9sxCZX3clNWHCFZTjMakXfJvZ3jmVxiOi/AKhDSSWYfEc27s9JKAgu1kbMdMST5gqGk4M rM5DoKuA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kb0t8-0007Qh-8Q; Fri, 06 Nov 2020 12:30:42 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, hch@lst.de, kent.overstreet@gmail.com Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 2/4] pagevec: Increase the size of LRU pagevecs Date: Fri, 6 Nov 2020 12:30:38 +0000 Message-Id: <20201106123040.28451-2-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201106123040.28451-1-willy@infradead.org> References: <20201106080815.GC31585@lst.de> <20201106123040.28451-1-willy@infradead.org> MIME-Version: 1.0 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: Tim Chen reports that increasing the size of LRU pagevecs is advantageous with a workload he has: https://lore.kernel.org/linux-mm/d1cc9f12a8ad6c2a52cb600d93b06b064f2bbc57.1593205965.git.tim.c.chen@linux.intel.com/ Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagevec.h | 5 +++++ mm/swap.c | 27 +++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index ee5d3c4da8da..4dc45392d776 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -29,6 +29,11 @@ struct pagevec { }; }; +#define declare_pagevec(name, size) union { \ + struct pagevec name; \ + void *__p ##name [size + 1]; \ +} + void __pagevec_release(struct pagevec *pvec); void __pagevec_lru_add(struct pagevec *pvec); void pagevec_remove_exceptionals(struct pagevec *pvec); diff --git a/mm/swap.c b/mm/swap.c index d093fb30f038..1e6f50b312ea 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -45,14 +45,17 @@ /* How many pages do we try to swap or page in/out together? */ int page_cluster; +#define LRU_PAGEVEC_SIZE 63 +#define lru_pagevec(name) declare_pagevec(name, LRU_PAGEVEC_SIZE) + /* Protecting only lru_rotate.pvec which requires disabling interrupts */ struct lru_rotate { local_lock_t lock; - struct pagevec pvec; + lru_pagevec(pvec); }; static DEFINE_PER_CPU(struct lru_rotate, lru_rotate) = { .lock = INIT_LOCAL_LOCK(lock), - .pvec.sz = PAGEVEC_SIZE, + .pvec.sz = LRU_PAGEVEC_SIZE, }; /* @@ -61,22 +64,22 @@ static DEFINE_PER_CPU(struct lru_rotate, lru_rotate) = { */ struct lru_pvecs { local_lock_t lock; - struct pagevec lru_add; - struct pagevec lru_deactivate_file; - struct pagevec lru_deactivate; - struct pagevec lru_lazyfree; + lru_pagevec(lru_add); + lru_pagevec(lru_deactivate_file); + lru_pagevec(lru_deactivate); + lru_pagevec(lru_lazyfree); #ifdef CONFIG_SMP - struct pagevec activate_page; + lru_pagevec(activate_page); #endif }; static DEFINE_PER_CPU(struct lru_pvecs, lru_pvecs) = { .lock = INIT_LOCAL_LOCK(lock), - .lru_add.sz = PAGEVEC_SIZE, - .lru_deactivate_file.sz = PAGEVEC_SIZE, - .lru_deactivate.sz = PAGEVEC_SIZE, - .lru_lazyfree.sz = PAGEVEC_SIZE, + .lru_add.sz = LRU_PAGEVEC_SIZE, + .lru_deactivate_file.sz = LRU_PAGEVEC_SIZE, + .lru_deactivate.sz = LRU_PAGEVEC_SIZE, + .lru_lazyfree.sz = LRU_PAGEVEC_SIZE, #ifdef CONFIG_SMP - .activate_page.sz = PAGEVEC_SIZE, + .activate_page.sz = LRU_PAGEVEC_SIZE, #endif };