Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4394818rwd; Tue, 23 May 2023 07:13:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52DSxUcudt4QBlhO79MG9kOVMEunc5v/6uXECOPiMtxmWWA9HAYElbtyjn40KF9/U4AP+a X-Received: by 2002:a17:902:c952:b0:1a0:76e8:a4d with SMTP id i18-20020a170902c95200b001a076e80a4dmr19374042pla.14.1684851187196; Tue, 23 May 2023 07:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684851187; cv=none; d=google.com; s=arc-20160816; b=tY/uxB20v4aY47Pf++xcEoFMCdawEBV1pfpeDn6kq5sql4mU7xMRUY7kf+qSAqCZpk uFbpOEs3/nciZqEYN71XzYyHbU7FORef/bRImEmaKDyLeQlPL3jHSChGNigdo3PyT5LE 4ej6h29xgihLKiVSQpQOpbGgFjApz+X270iRWq4JRWNHzZma3D6frLl961dygnebbW1Z uWdae4UU0dV8cYxDNsN3kmXg4kY1WO9GTmzKTS9l9svibvT+gLmztip2MFx2gwP+88SQ lq59F3Cu/MoTBzsYG6SJ4s+Stc5GJJkxPP/+hAtp41zYUYoD965NmcRVWTIikVspMyI+ TOOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1H4Y9LOWc0olNcXTJ1OgzMgJyqMLn68QmxQ5MJNIIbk=; b=VqepsAGrsM591JMYB+3hOgladCfvG5Oiao0DzC2tmY/itiZDc4um9fKzYb+RRfGuMF 6bVy1dKVCjVAdstRFtCCUJ2wlK4bfEstCMY7AdUfpJK8T+/DRbibqcP0w0nwBA+b990c wfrdyav5L4hDOlQTy0qIO74BOZ5yPgvZutknrqwVpXOPA2Vn23xmDI6yepBlr/cT1T4k nQVW0gC8MwWzH0O4nWc7gLJDK776IYb9c7AbK836Qq0CL90CEn/lwi3ZQaGsG9qGpzMX WGEqDwr41nHT0OS4CrR7plf6nwLS/Nvro9Ex2q+nUmF4KQ7ngNwIqBWgHJDQSVccwG2Y 1Hig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hm0QvYO2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170902724900b001ac5dd95bc5si1470095pll.476.2023.05.23.07.12.53; Tue, 23 May 2023 07:13:07 -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=@gmail.com header.s=20221208 header.b=hm0QvYO2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237043AbjEWOMJ (ORCPT + 99 others); Tue, 23 May 2023 10:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236974AbjEWOLk (ORCPT ); Tue, 23 May 2023 10:11:40 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F4DDE43 for ; Tue, 23 May 2023 07:11:14 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-1afbc02c602so14681965ad.1 for ; Tue, 23 May 2023 07:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684851074; x=1687443074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1H4Y9LOWc0olNcXTJ1OgzMgJyqMLn68QmxQ5MJNIIbk=; b=hm0QvYO2s07hmkORFZZR4aVyZ/jqwyle0dMvFSk5q15ngH4GxUS3LLxTamXa5eElWb IOeM/maPPtabDfU38GwHjIrtz342LMcUoGsDWCVgOWhU9XSyQ/I0NY/k85ptEnu/KgVN BHRGywKBmdEkHTGKKm4f8ndGWoqzUi9TJL+6nftZkBXFAXyXmVqmsQXAX0auRKSPjz56 Q9l/vZTG9ApPNNZY4IECfKDjWpMw6liB4F3zHjtfICmFbRzWJHb0JH6qH12Q7AgJlGDZ CuqEJQS/9sM+JX18ywoGohtrVQiMB4qVj//D43zfO8X1/+FWPQOcPqRCnOrPpHVU2p+R +jvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684851074; x=1687443074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1H4Y9LOWc0olNcXTJ1OgzMgJyqMLn68QmxQ5MJNIIbk=; b=SPgJpe+/RErpzWIxmvIzc2Pn84mkdIE08TkvcDgAS2YqCFYDzaWe0FH7Nxb+aE4o3D LqPOQ6DACtjHn4Gu62SvjMXcAAKdq6mG2rxIvP0fuHA1ti8NaxDVZFlNnO6Zxc5XQO1Z Eaffwo2Vyf9H7rNf+nHk6pfc5wGECq/0/CLUuGk5HV6+eGPpzNocGsyovOIFk8qUnbKC 6uFrgRcg+M3Fm+CmcfVRLFmHZqF5SVESq5E4/g6IBe9rygB7hxPtXWJZN4a0P134xIxV 7vmvJVfXPPurWOMWGoTpTBeGmicIuWWhDmVUV4lbeBIim3PLzCXY23JvICfBQF23tK5S 6gVA== X-Gm-Message-State: AC+VfDwMV88QsTm8Byn9wwKTuF1ja7HnQVbCVzByI/iVX5yJiGgeBbCH BOJjvViGFnhY8YLHA5idcZU= X-Received: by 2002:a17:902:e5ce:b0:1a2:a904:c42e with SMTP id u14-20020a170902e5ce00b001a2a904c42emr16753653plf.24.1684851074083; Tue, 23 May 2023 07:11:14 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id u13-20020a170902e5cd00b001ac937171e4sm6834511plf.254.2023.05.23.07.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:11:13 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: david@redhat.com Cc: akpm@linux-foundation.org, imbrenda@linux.ibm.com, jiang.xuexin@zte.com.cn, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ran.xiaokai@zte.com.cn, xu.xin.sc@gmail.com, xu.xin16@zte.com.cn, yang.yang29@zte.com.cn Subject: Re: [PATCH v8 1/6] ksm: support unsharing KSM-placed zero pages Date: Tue, 23 May 2023 22:11:04 +0800 Message-Id: <20230523141104.7029-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <4b7e4d48-f0f9-c0b0-e8e1-2678d0306252@redhat.com> References: <4b7e4d48-f0f9-c0b0-e8e1-2678d0306252@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 >>>> --- >>>> include/linux/ksm.h | 6 ++++++ >>>> mm/ksm.c | 5 +++-- >>>> 2 files changed, 9 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/include/linux/ksm.h b/include/linux/ksm.h >>>> index 899a314bc487..7989200cdbb7 100644 >>>> --- a/include/linux/ksm.h >>>> +++ b/include/linux/ksm.h >>>> @@ -26,6 +26,9 @@ int ksm_disable(struct mm_struct *mm); >>>> >>>> int __ksm_enter(struct mm_struct *mm); >>>> void __ksm_exit(struct mm_struct *mm); >>>> +/* use pte_mkdirty to track a KSM-placed zero page */ >>>> +#define set_pte_ksm_zero(pte) pte_mkdirty(pte_mkspecial(pte)) >>> >>> If there is only a single user (which I assume), please inline it instead. >> >> Excuse me, I'm wondering why using inline here instead of macro is better. >> Thanks! :) > >Just to clarify: not an inline function but removing the macro >completely and just place that code directly into the single caller. > >Single user, no need to put that into ksm.h -- and I'm not super happy >about the set_pte_ksm_zero() name ;) because we get the zero-pte already >passed in from the caller ... Oh, I see. Thanks