From patchwork Wed Aug 12 04:04:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11710223 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 5D043618 for ; Wed, 12 Aug 2020 04:04:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 25D4320768 for ; Wed, 12 Aug 2020 04:04:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="csaCe0hu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25D4320768 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 13FF66B00AD; Wed, 12 Aug 2020 00:04:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0C9806B00AE; Wed, 12 Aug 2020 00:04:34 -0400 (EDT) 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 EAD406B00AF; Wed, 12 Aug 2020 00:04:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0023.hostedemail.com [216.40.44.23]) by kanga.kvack.org (Postfix) with ESMTP id D2BCF6B00AD for ; Wed, 12 Aug 2020 00:04:33 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4D972180AD806 for ; Wed, 12 Aug 2020 04:04:33 +0000 (UTC) X-FDA: 77140574826.10.way28_2810da926fe8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 1F6E716A0C3 for ; Wed, 12 Aug 2020 04:04:33 +0000 (UTC) X-Spam-Summary: 1,0,0,ef71572da4091c34,d41d8cd98f00b204,3t2ozxwykcpaqmrzsgyggydw.ugedafmp-eecnsuc.gjy@flex--yuzhao.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:966:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3867:3870:3871:3872:4321:4385:5007:6119:6120:6261:6653:6742:7901:7903:9010:9969:10004:10400:11026:11658:11914:12043:12297:12438:12555:12679:12895:13069:13311:13357:14096:14097:14181:14394:14659:14721:21080:21212:21444:21627:30054:30079:30091,0,RBL:209.85.219.202:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04ygebq54y64rcfirjfd9tahq1xnhoc4b3x4x833xqiw31idko7tuy43kpja8su.5rgta1hfn6j5ap94w4g94cwnycqoyzw94y8b1qzckzxrutzwk556d3ked1izwdy.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY: none X-HE-Tag: way28_2810da926fe8 X-Filterd-Recvd-Size: 3988 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Aug 2020 04:04:32 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id p138so1416539yba.12 for ; Tue, 11 Aug 2020 21:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=v1Nsq9N+YQMLR2jVkYck8gxTVP3hZK8QOU/HVFJRBuQ=; b=csaCe0hu/9JP+zZ//ozPOmHL0XLWrT5paJCyufD/RjSWZqGoymXuR8bYKZwSQ1xuZU vIRZSMK8FDns62Qcd5FuuBDWnbNstU2ZV3QKwHO4SKL9M153Ij5kZ4jAm0EicHVAYUdH k/4Zp5xdQLxCmW1c14Jo+q3jtnrXto5cI0aIfUTZ0m/iJrfRU2zIe56v7fK2poN4b/h8 u5JFRJTCIIHeXq6HQhlgkpYbk4E43h4brKG+y5t+/+qraGWTrPcKitVVNIXAtw5uDYzS +zsRCwUeR8tA9RcYzpoeNggIOfI4bIGICR619BYk6opbVjwcQhA5S2W8uqHf8wRDQ1xY cG9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=v1Nsq9N+YQMLR2jVkYck8gxTVP3hZK8QOU/HVFJRBuQ=; b=rEi+q53B9lpN6VG2xzsF4iTWgIIVPoPNMWpQVbSElElRcFH7N7eWHYLigxDPSjQUnR 1sdvKJHDAuZojsZywTwDIUlmv09hTn7TU9yovoF4A+AN0Q//wJslPZX1o2jE2pjr4ukC e0zRahxUfaVqDInwqDXEf6aiNYmNnprZGdr7mFfpAzvbEcudrHXitMLHj02XVpGUwmxi 1onDO2AwQTMvjoCYiL6V7GnAboAGfpHNvLgY6J0qMO2reYNaOBNYfMfKo58PyLyCkXqb sye5Ob+WnREIGq7HMJgIuxUgw6KBsPLQns2UG5l+LVR7SHc4RpFC3QewcclfWOhn88lk I9fQ== X-Gm-Message-State: AOAM533mTc3pDjoVXsLdz2CdT8K78rz9YkogMNeYHfBclSKtE2RDvew5 4Mn2xG1S3u/z8VvuJqoGuVCs+oGARTg= X-Google-Smtp-Source: ABdhPJzgKSVVawICdS1/tR2l0UkUBVuqBVVkP81T13b/A37jSsQT9YvQyxxxCErkAdkeK4g0XQL0xeV+dhs= X-Received: by 2002:a05:6902:4c6:: with SMTP id v6mr25855740ybs.499.1597205071788; Tue, 11 Aug 2020 21:04:31 -0700 (PDT) Date: Tue, 11 Aug 2020 22:04:23 -0600 Message-Id: <20200812040423.2707213-1-yuzhao@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog Subject: [PATCH 1/3] mm: don't call activate_page() on new ksm pages From: Yu Zhao To: Andrew Morton Cc: Alexander Duyck , Huang Ying , David Hildenbrand , Michal Hocko , Yang Shi , Qian Cai , Mel Gorman , Nicholas Piggin , " =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= " , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao X-Rspamd-Queue-Id: 1F6E716A0C3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: lru_cache_add_active_or_unevictable() already adds new ksm pages to active lru. Calling activate_page() isn't really necessary in this case. Signed-off-by: Yu Zhao --- mm/swapfile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 6c26916e95fd..cf115ea26a20 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1913,16 +1913,16 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, pte_mkold(mk_pte(page, vma->vm_page_prot))); if (page == swapcache) { page_add_anon_rmap(page, vma, addr, false); + /* + * Move the page to the active list so it is not + * immediately swapped out again after swapon. + */ + activate_page(page); } else { /* ksm created a completely new copy */ page_add_new_anon_rmap(page, vma, addr, false); lru_cache_add_active_or_unevictable(page, vma); } swap_free(entry); - /* - * Move the page to the active list so it is not - * immediately swapped out again after swapon. - */ - activate_page(page); out: pte_unmap_unlock(pte, ptl); if (page != swapcache) {