From mboxrd@z Thu Jan 1 00:00:00 1970 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 2485521A436 for ; Thu, 9 Jan 2025 13:40:54 +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=1736430056; cv=none; b=QbZ4x9omf5A7r4Kkz9QJvP9+ytEwv48AnOrcmRFGz/SWzyTdbe00+jV65Jry0hyoW70XbhwnNienWQ+x/Hb/Tl0jWmCkS2eTqRBkPacqKqZER2X5bU3gWAxeuHoFRk3cfBIhHS1X70tOA7+qv0YZLI+xHCj+WbzI03lcsLHVAO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736430056; c=relaxed/simple; bh=i4GpasgDmnZ3nUmxjEG231RxdxxTozEP50hDwnDQFMg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R9gv3lGANGCeCGIkZLuwgFf3gFWfPKiZfiIKTm3MuEuyPJOEocJ5mWTgc48sReZyRYFNruaBGzO03X5Pi0ARHDk/L6yTKVVSNDaQ+CKLQyS7GXXuTvxwEvZuL1X6VkklSHYmLYBCpJD84FY+ijrZUSDbl326soAiJMXLz80aSAk= 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=XoFnguaQ; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XoFnguaQ" 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=5ONkHYJbSiJ+lgRj5oCXMcej9oxZjVhTQh5GSrqSFnw=; b=XoFnguaQScdeB+y2eXOvayZbDn PmjUfRVQwoTcFKu9G9azrG5d6QlGTjUUcs6i6seWo8n4R1POuiTkgwqdw+GPX2i+Yca6BRmQuJiB8 c2gUHAWJ09qxpq7Z4zh7LuNiB4W8PzfeNkLzuvA93xWUE+Ksr09XdxzQThn7Mm+rI0RpUaH6qvfkh sKhuy8x8Y/g4BR25cyWGi2BErEdZpKz+Cx4O6tJz4WIsEp1QHdt+GR+VVqCDAnTmYrUGAIawJ8yVx F06s3P52+yncPhtD39ihAzQxjtgo4f9e12DHPBcK6CvFYMOMhKZlUTEMNMGecsMGgK/E6XAyRJooU 8dJqM0qw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tVsmA-00000006DJJ-2aan; Thu, 09 Jan 2025 13:40:42 +0000 Date: Thu, 9 Jan 2025 13:40:42 +0000 From: Matthew Wilcox To: Liu Shixin Cc: Andrew Morton , Chengming Zhou , Kefeng Wang , Nanyong Sun , Muchun Song , Qi Zheng , Johannes Weiner , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: khugepaged: fix call hpage_collapse_scan_file() for anonymous vma Message-ID: References: <20250109070059.369257-1-liushixin2@huawei.com> 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: <20250109070059.369257-1-liushixin2@huawei.com> On Thu, Jan 09, 2025 at 03:00:59PM +0800, Liu Shixin wrote: > Add vma_is_anonymous() check to make such vma be processed by > hpage_collapse_scan_pmd(). Wouldn't it be better to replace the vm_file check with vma_is_anonymous()? ie: > - if (IS_ENABLED(CONFIG_SHMEM) && vma->vm_file) { > + if (IS_ENABLED(CONFIG_SHMEM) && vma->vm_file && > + !vma_is_anonymous(vma)) { + if (IS_ENABLED(CONFIG_SHMEM) && + !vma_is_anonymous(vma)) {