From patchwork Fri Apr 3 11:29:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 11472555 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 A57C814DD for ; Fri, 3 Apr 2020 11:29:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 714D52073B for ; Fri, 3 Apr 2020 11:29:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="ElPWX9Fb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 714D52073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A07738E0008; Fri, 3 Apr 2020 07:29:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 99AB08E0009; Fri, 3 Apr 2020 07:29:35 -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 8A6658E0008; Fri, 3 Apr 2020 07:29:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6EC2B8E0007 for ; Fri, 3 Apr 2020 07:29:35 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 30A13180AD804 for ; Fri, 3 Apr 2020 11:29:35 +0000 (UTC) X-FDA: 76666323510.21.low20_36890cb5d7616 X-Spam-Summary: 2,0,0,d0409a4e527b1da5,d41d8cd98f00b204,kirill@shutemov.name,,RULES_HIT:41:355:379:541:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:1801:2393:2559:2562:2911:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:4250:4425:4605:5007:6119:6261:6653:7875:10004:11026:11658:11914:12043:12291:12294:12297:12517:12519:12555:12679:12895:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14581:14721:21080:21444:21451:21627:21740:30054:30056:30070,0,RBL:209.85.208.178:@shutemov.name:.lbl8.mailshell.net-62.14.0.100 66.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:30,LUA_SUMMARY:none X-HE-Tag: low20_36890cb5d7616 X-Filterd-Recvd-Size: 4370 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Apr 2020 11:29:34 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id n17so6559150lji.8 for ; Fri, 03 Apr 2020 04:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ivrfh7z+5XsuRxl0JPRhZnQ37vhg7rSvfqWMZmGEcXs=; b=ElPWX9FbdM6JPGRFIhhPZkGVO5q7IJ1VgQALnpLlFSnI9ZJMC3+AvZ3qYMpPvMuW7P yQfRGnrF240fVWbn+OlPwFypuWdv1zc3muz+A/l1iSU2i6Xwjb8DnyVWJFC+aOo7svHx RnAA5e8Qv11UmdY0qYR8/m1wG+1Ac9SqjaaFzlZlnxbLr9YQgqGBH9OigINjT2wwqD+K Q887i99gVLiASa8scRXEZ4blo3XrR8kF7SUYms1UCGTC1BrTVSB4RlieRWPBztg1pCqn wbwK0NtOWWBUnImOz3CevhQGKXWO9n/4PJhEI2pPcDFguxrkVZPFscvrrtpu4FnGYxaD YCIA== 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:mime-version :content-transfer-encoding; bh=Ivrfh7z+5XsuRxl0JPRhZnQ37vhg7rSvfqWMZmGEcXs=; b=jMpEQ1Ynz+ReY1Icp71hVI+jas/lvYVTzTzuiSTFOLV3rTscbg2MoMFC+uIG9IHxXg AwX/tiTeBFXnXM785IV93JI/HmDTB7lgK/qWYogZ5ziKGN9KW8OPWOTZwh1rto08SbDN 0wYRg4KCjCTaw12CFlWBzpxsP3QfynWeWNytipXUnH0CApZokMsuDf/U4pz0sOsu4z2C CRpIKkAAlaHBp3Cajae8xTLimsWp3atJq+ZyCq2eMm6xwUSn9y8santToTm245Bx8+uU ZyOaQg6b9BGA/UzpAZnHMj/qMrhZd4oWnWldx9gsPC6etORfhc2mnqljkL8FUWcK+cif 9kmQ== X-Gm-Message-State: AGi0PuZ7218enwfI3d/U/2e6DWMr/ZcoZWQoVMJ/Q8jhJ7UsBsKqeDGF QsjtUulPNUafW6f8strK7+FCmGJvy8U= X-Google-Smtp-Source: APiQypKIsAU7hf9BDVG0hZw+U8GteBcrKYt9kbqLTPjGC/HdKoijoAe0wnebTjPQfo1qKqZ+NTrbEg== X-Received: by 2002:a2e:9652:: with SMTP id z18mr110590ljh.79.1585913372734; Fri, 03 Apr 2020 04:29:32 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id v9sm4914153ljv.82.2020.04.03.04.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 04:29:32 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id 5F04E10132C; Fri, 3 Apr 2020 14:29:31 +0300 (+03) To: akpm@linux-foundation.org, Andrea Arcangeli Cc: Zi Yan , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv2 0/8] thp/khugepaged improvements and CoW semantics Date: Fri, 3 Apr 2020 14:29:20 +0300 Message-Id: <20200403112928.19742-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.26.0 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: The patchset adds khugepaged selftest (anon-THP only for now), expands cases khugepaged can handle and switches anon-THP copy-on-write handling to 4k. Please review and consider applying. v2: - Fix race in compound page handling; - Add one more test-case for compound page case; - Rework LRU add cache draining; - Typos; Kirill A. Shutemov (8): khugepaged: Add self test khugepaged: Do not stop collapse if less than half PTEs are referenced khugepaged: Drain all LRU caches before scanning pages khugepaged: Drain LRU add pagevec after swapin khugepaged: Allow to callapse a page shared across fork khugepaged: Allow to collapse PTE-mapped compound pages thp: Change CoW semantics for anon-THP khugepaged: Introduce 'max_ptes_shared' tunable Documentation/admin-guide/mm/transhuge.rst | 7 + include/trace/events/huge_memory.h | 3 +- mm/huge_memory.c | 249 +----- mm/khugepaged.c | 184 +++- tools/testing/selftests/vm/Makefile | 1 + tools/testing/selftests/vm/khugepaged.c | 982 +++++++++++++++++++++ 6 files changed, 1153 insertions(+), 273 deletions(-) create mode 100644 tools/testing/selftests/vm/khugepaged.c Reviewed-by: William Kucharski