Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp145024rwr; Wed, 19 Apr 2023 04:47:53 -0700 (PDT) X-Google-Smtp-Source: AKy350bQ3S0gJcyJBjAbJBjme/79ss1jcBF0sdXfd8fXCpmbHxbLKl5MtnN7dxqs7PaX0+jeo75r X-Received: by 2002:a17:903:1205:b0:1a6:fe25:412b with SMTP id l5-20020a170903120500b001a6fe25412bmr5897610plh.26.1681904873153; Wed, 19 Apr 2023 04:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681904873; cv=none; d=google.com; s=arc-20160816; b=PbPNHB2zDLd5Q2ZZENH/zz56sxwA4Kt8a3CqU+eEQYDyPIfq9gs3FZ4B3fmnOFbdke 8s9iw+I4CvFDarRCICmFjnGPsiAs85Yr14yypOKMtSNFxKSwWSvoqxdD/97tdZvEob77 p21a74WCXVSYe1jEPwFDO8rLYVuc2gvl8lkjm7ItT40cXm/q7Q57BZZQ27lpjH6cLOBn eDfABNi8SuAh/Crjr0CthaRP41IPrxWV4xXVSxDpU9IsvWYbpjZDvjRmnU5vbxfjp9TG GkuHCIJe/E4Dl/VqsmmI7meHuaxXfXwptEBOdDRvLEbkTK40hQb7qyT9B5fzMoyfYKHB 53tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=d94kMyGvyZL17XK7WKirw3h92EHgohkqQ/7jeLjX7+U=; b=hrepEWYp94zfe+nDslfx3m55hMhHbY+KswGCkrLBCS4H3jAJ6g+Vn8Ll6Yg0EAhu/A xStXvPOXiaIqUJKiP5Ne9/XcJpmYUkznRNSdw9p3xngrGQ23EgPa+iPcpxxiiBBKBpb2 XMkgOkbhRCyy2LwMTbTWG72q0Ip1PAZ61AbJq70FLfRw2mgSBAnRcNmwnwqIgFAowlfB 5XBwzCrZvt1cp6cB5lpyGurAKBVmKD7sMc87G5iVPPJD1qdGkhLDbsLFo1v4uIddVAAt qDb3ERtF3UOaVIolF1ZZuW28buyYYnC0HtxE0Bq8XeRYZgCGJR7Zn7yGcyqcJEt/ySxl eDyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RStd1pjj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a170902a3c900b001a922c7f51dsi580109plb.172.2023.04.19.04.47.41; Wed, 19 Apr 2023 04:47:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RStd1pjj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232019AbjDSLlN (ORCPT + 99 others); Wed, 19 Apr 2023 07:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbjDSLlM (ORCPT ); Wed, 19 Apr 2023 07:41:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2371999 for ; Wed, 19 Apr 2023 04:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681904422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d94kMyGvyZL17XK7WKirw3h92EHgohkqQ/7jeLjX7+U=; b=RStd1pjj0sWU/Vfgzkb5oQpz76DGWeIy1DNBZwXsburYYmYqT9uXVlDjILVkIWbnAiuiAw JGTWghniQTXJgmip2M4EztVy68M0lUinzw47oihJTa1z7B4H3ZjL2Nuip5xSOMwfLGyPYY ClgeFgPqE7KQQudXTr/0TZlkWpsJnXc= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-640-dyzpp2QsP7iKVgW7WnCUXA-1; Wed, 19 Apr 2023 07:40:21 -0400 X-MC-Unique: dyzpp2QsP7iKVgW7WnCUXA-1 Received: by mail-wm1-f71.google.com with SMTP id bd16-20020a05600c1f1000b003f172e02edbso1004536wmb.4 for ; Wed, 19 Apr 2023 04:40:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681904420; x=1684496420; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=d94kMyGvyZL17XK7WKirw3h92EHgohkqQ/7jeLjX7+U=; b=AP/yGh+CpRVZiv2Rq7e/m0zejDzUTrowFqUsf8xiULBBN0SqUi1GZihPucftt7uxEA vkOMdzcfPOa+CWeFXUDHvsRJzmFcZaPrW0771fOiOKTJN2RCVyDdSCXaVgZ1DsmyULK6 lsMExhRtCj8HQzre05E3qDQtCU4OJ2zDOiLh0Xp1GEn0NLFYcJ4rFI+QWMBcd0mF0YyR qwXTIhQN0xUElPya/EaVN9qycj/Cq4dfrnVU9ItarALq7Y75LPPPrvfIFXeyAa/zd53w tEfJVf8+6qd+YAS80427JGt2532DWAYsEaCfssKYyz6GmBI1APBStdCVP2k9ZzenXwEb G5Qg== X-Gm-Message-State: AAQBX9dh8vSAobIfkCuEV07dgK3Aoh0AV73EfwYJOBj9GERx71cI+gjn s2S8q6mUplmfYPtCbF1Pg+dF3ffjxajJ8Bi42ydic1Kp3wO3e7Cc/JaX0pqkRAFhG1meJKRTofM NG9dzMtbUxxpzN8nIgANuGE0C X-Received: by 2002:a05:600c:ac4:b0:3f1:6ead:34fe with SMTP id c4-20020a05600c0ac400b003f16ead34femr11020929wmr.26.1681904419994; Wed, 19 Apr 2023 04:40:19 -0700 (PDT) X-Received: by 2002:a05:600c:ac4:b0:3f1:6ead:34fe with SMTP id c4-20020a05600c0ac400b003f16ead34femr11020914wmr.26.1681904419705; Wed, 19 Apr 2023 04:40:19 -0700 (PDT) Received: from ?IPV6:2003:cb:c70b:7b00:7c52:a5fa:8004:96fd? (p200300cbc70b7b007c52a5fa800496fd.dip0.t-ipconnect.de. [2003:cb:c70b:7b00:7c52:a5fa:8004:96fd]) by smtp.gmail.com with ESMTPSA id d17-20020a056000115100b002fa6929eb83sm7870151wrx.21.2023.04.19.04.40.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 04:40:19 -0700 (PDT) Message-ID: <743c4686-43aa-15fa-5989-af9a43a783f9@redhat.com> Date: Wed, 19 Apr 2023 13:40:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v1 3/3] mm/ksm: move disabling KSM from s390/gmap code to KSM code To: Janosch Frank , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Stefan Roesch , Rik van Riel , Johannes Weiner , Michal Hocko , Christian Borntraeger , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Sven Schnelle , Shuah Khan References: <20230418051342.1919757-1-shr@devkernel.io> <20230418152849.505124-1-david@redhat.com> <20230418152849.505124-4-david@redhat.com> <42df1c58-f0bf-5dd8-03db-ee2fa28d7c1b@linux.ibm.com> Content-Language: en-US From: David Hildenbrand Organization: Red Hat In-Reply-To: <42df1c58-f0bf-5dd8-03db-ee2fa28d7c1b@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19.04.23 13:39, Janosch Frank wrote: > On 4/18/23 17:28, David Hildenbrand wrote: >> Let's factor out actual disabling of KSM. The existing >> "mm->def_flags &= ~VM_MERGEABLE;" was essentially a NOP and can be dropped, >> because def_flags should never include VM_MERGEABLE. Note that we don't >> currently prevent re-enabling KSM. >> >> This should now be faster in case KSM was never enabled, because we only >> conditionally iterate all VMAs. Further, it certainly looks cleaner. >> >> Signed-off-by: David Hildenbrand >> --- >> arch/s390/mm/gmap.c | 20 +------------------- >> include/linux/ksm.h | 6 ++++++ >> mm/ksm.c | 11 +++++++++++ >> 3 files changed, 18 insertions(+), 19 deletions(-) >> >> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c >> index 0949811761e6..dfe905c7bd8e 100644 >> --- a/arch/s390/mm/gmap.c >> +++ b/arch/s390/mm/gmap.c >> @@ -2585,30 +2585,12 @@ EXPORT_SYMBOL_GPL(s390_enable_sie); >> >> int gmap_mark_unmergeable(void) >> { >> - struct mm_struct *mm = current->mm; >> - struct vm_area_struct *vma; >> - unsigned long vm_flags; >> - int ret; >> - VMA_ITERATOR(vmi, mm, 0); >> - >> /* >> * Make sure to disable KSM (if enabled for the whole process or >> * individual VMAs). Note that nothing currently hinders user space >> * from re-enabling it. >> */ > > Is that still true? Yes. We'd need another per-MM bit to stop it from getting re-enabled. > > My KSM knowledge is nearly zero but from what I can see the patch looks > ok to me: > Acked-by: Janosch Frank Thanks! -- Thanks, David / dhildenb