Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1491097lqt; Wed, 20 Mar 2024 05:54:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyBFow5lPrJhSUQntNwVmxEPWicZB7dA9sGXMFnXjZB2lFnICXR13ypuuFykwLUFq2Kv5cAaDwNXIiu+uYeiE0zUt1hr1zZlGBWy8zig== X-Google-Smtp-Source: AGHT+IHO+97ss2WuXXAzpvFYWGGoMATmezKLc83T2BYXXcQAzIG/Qjm+DRCDQhZbtjGZemSd9P3I X-Received: by 2002:a17:903:192:b0:1e0:3347:5bf with SMTP id z18-20020a170903019200b001e0334705bfmr2529870plg.37.1710939297722; Wed, 20 Mar 2024 05:54:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710939297; cv=pass; d=google.com; s=arc-20160816; b=h6nlkhBW//GX8aEzXxl8eqttLULT52P9x8AWacaQGeMskTaoWOMCuXyq76PxMXIwoo v2txHIwBNImljLIWOkD0FaL4hNTKpWCBhyAj+AyBwMI1/+n/3lxMYTnrKwadmFNNh37f wgzYhycgxZFMC+1SyzoH5JgvVXGXOK5ctyw6IeiwPS3xsEOGu1w+hi+f0jhbUQw9sLVz sWG/znc32orLuqR2GgRjUhyPlYbLXpHWqjBXtgZRrdCr1GDldy5gb9BkYYG0chIsu5o5 +fV0cuLbksreoxVgjVnAcVY/FmHJDDkC/l2l4eDGG5AWO7ziTgoLgMNcBb0ft3vyRjtO NdCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Q5DZVbBlgdY/ijS/sr5XzHi7g8HUvHiHBkBIhAImlBA=; fh=ieeEHCSmkFZzD0II1P2iPLHoQdL5rt4/kKBbteAFI8k=; b=HyQ/HGk/mBqWFGq1Fl1wwC5TbB0JCfnPhp5DwYZGqNjeyzf7FiXmBxWGtyvMnL9LK+ bpGEK1Q65x8cF81Tu0b+3fTZSVwtJC43YFy9F5u+uZ2gG8IF2/1zfNvT+MJPczEqfSIq oSQzlV6XpA6yM826fhD/UVworkNxWKm/yMxmJETa1x5butDEXoZB95w5FbfRPsC07cQf gwv/7ID2dYAS/tsWYHtoA0i2HEw4FMn/asqi5SCaGZ3ggteAspMsX5pJgi4UgAVcNSwd XmIfzjbgHwTtn39PMDDKT8mQjAqsmahwFSbhGXNHsK4zNia9JT4VXFMC8flUFGQuzrEG SJvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=f96N0vgZ; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-108919-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108919-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x4-20020a170902a38400b001dee4060a2csi11581341pla.316.2024.03.20.05.54.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 05:54:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108919-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=f96N0vgZ; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-108919-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108919-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 68CA4283A7D for ; Wed, 20 Mar 2024 12:54:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 546C940BFA; Wed, 20 Mar 2024 12:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="f96N0vgZ" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E18340BE2 for ; Wed, 20 Mar 2024 12:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710939292; cv=none; b=Gf0Em9a6CJH4oDgllu87Qm8WQoohwAYjgRfon5c7zNuCLcZc+MiCFDvPtO+UEgi97l8S/Uc5yhiuuawCwhGS+v1g5bUv+nH90oOML6/0L69vhNGgaTIxPnawkxf5lrLfNXbWCgIDcKhF1+qJZYpZSZLKccM/C3UmRVdymTw620E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710939292; c=relaxed/simple; bh=aMIE+s94DUqJh+O6nig1IO/d5/0GWgvYw2BVlR/gCCY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AH48+ya9gDxkWs18GErpcSCFTGF1nhEUD0YWf80dxyNRvVdeqZob78M+SwdbJM+qwRAX5CedjLc/wJLidrEjFRHNIpeEFLXchkkc2GyWzKy6TGQbjFuu/X8pIOHmEPAuwPREgabPrxNNGLJrvuukbm1dl1NmZO0zRCRcgIKfGi0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=f96N0vgZ; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Q5DZVbBlgdY/ijS/sr5XzHi7g8HUvHiHBkBIhAImlBA=; b=f96N0vgZi46mEsOaJTXd20XzPY n2vtse5NKfY9beFU2Y2cTK3Qop4yRyKH2DDQujn0l7ojf7TjxEz9/CEczwfFSlp3Y9VBJlb9s0xOE e+AUC65hkMDzFKyeCcA6eJ04yB9xIDn7unwX90ZKhfRV//xrv+MWg/TiXSycSlPCzGmompJz4V5hs 1/sVg7D/PSO/Z/+H0LTTV8Z6QQnJdSxQnNLNLq9HOx1lKuhzV1TnpVNshrhiVfQZ0jpwVffub1zEV tlwvYUnGKcOB2vM6F+Hr+mx0c+hzB7C/D+ihI9iw+sM+Ztx4BWaN0Cz5q/99mMG5bkT+KGS1G5gB5 6gDe3ttA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmvSk-00000004KmR-0XZi; Wed, 20 Mar 2024 12:54:34 +0000 Date: Wed, 20 Mar 2024 12:54:34 +0000 From: Matthew Wilcox To: alexs@kernel.org Cc: Izik Eidus , Andrea Arcangeli , Hugh Dickins , Chris Wright , kasong@tencent.com, Andrew Morton , "open list:MEMORY MANAGEMENT" , open list Subject: Re: [PATCH 01/11] mm/ksm: Convert get_ksm_page to return a folio Message-ID: References: <20240320074049.4130552-1-alexs@kernel.org> <20240320074049.4130552-2-alexs@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240320074049.4130552-2-alexs@kernel.org> On Wed, Mar 20, 2024 at 03:40:37PM +0800, alexs@kernel.org wrote: > -static struct page *get_ksm_page(struct ksm_stable_node *stable_node, > +static void *get_ksm_page(struct ksm_stable_node *stable_node, > enum get_ksm_page_flags flags) I am really not a fan of returning void * instead of a page or a folio. Particularly since you rename this function at the end anyway! You should do it like this: In this patch, convert get_ksm_page() to get_ksm_folio() and add: static struct page *get_ksm_page(struct ksm_stable_node *stable_node, enum get_ksm_page_flags flags) { struct folio *folio = get_ksm_folio(node, flags); return &folio->page; } Then convert each call-site to get_ksm_folio(), and finally delete get_ksm_page(). That way you're always converting each caller to the exact code you want it to look like, and your reiewrs don't have to keep three patches in their head at once as they review each place. Also, I think this should be ksm_get_folio(), not get_ksm_folio(). Seems to fit better. > @@ -949,32 +949,32 @@ static struct page *get_ksm_page(struct ksm_stable_node *stable_node, > * in the ref_freeze section of __remove_mapping(); but Anon > * page->mapping reset to NULL later, in free_pages_prepare(). Could you fix page->mapping to folio->mapping in the comment?