From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 BEDB225743E for ; Tue, 20 May 2025 03:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747710983; cv=none; b=SBSfCZIL1+q6BfTBGW5Tep3P+3+oAMInFMjBnkG+87xMqI7Smgjr5i/zOnshyRI1bpY8RSQywXJfXMyvHqACM6kPXkfMTqHXeuBuEEA+4GQv4dqvGl9s6fNBi1K5l95PTWQIviyAVgxL0cZueAp1nhRBHEnAMV6/EhTio1IEfKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747710983; c=relaxed/simple; bh=wr/SokuYkrOkEZ/CQiuuek5E2zh5L7FO0f9nUPx6fM0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Z++plpbIaizMAWoNU+foYJxocnZsowVUzRlmYmt2mYo7KJ8NXVirHaq43Ww78xGcA88mM4ogKUu6s+t4/xiOecUNl3r+bW568B6jsn9GWjMNRtYhu4z6y1ERTziV5pv7b3FtV3PvNGd3+o381wDWtwemQGSqex58vLCCUeafZT8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ll2qeVuw; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ll2qeVuw" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1747710967; 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=oQfMDoQ260BGjCMrcScg0wHQ7wmLuw8S4sagjFqk5vA=; b=ll2qeVuwHYlqF06nbJapV7M04PIb5JWw4ezsb3LpeLlHEgtvPM+woEGuhfJ+qNRUi6arka 5OrguEJWF2vBokVj0MAr24gB/mhPhZo/ZnGi1wrPXet3sYHISKXoMZ30IpS/Z4khtvFrEJ Ru/x3IjYboKkfu6GrysovtojXIv9V7s= Date: Tue, 20 May 2025 11:15:55 +0800 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 2/4] mm: ksm: refer to special VMAs via VM_SPECIAL in ksm_compatible() To: Lorenzo Stoakes , Andrew Morton Cc: Alexander Viro , Christian Brauner , Jan Kara , "Liam R . Howlett" , Vlastimil Babka , Jann Horn , Pedro Falcato , David Hildenbrand , Xu Xin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2025/5/19 16:51, Lorenzo Stoakes wrote: > There's no need to spell out all the special cases, also doing it this way > makes it absolutely clear that we preclude unmergeable VMAs in general, and > puts the other excluded flags in stark and clear contrast. > > Signed-off-by: Lorenzo Stoakes Nice. Reviewed-by: Chengming Zhou Thanks! > --- > mm/ksm.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/mm/ksm.c b/mm/ksm.c > index 08d486f188ff..d0c763abd499 100644 > --- a/mm/ksm.c > +++ b/mm/ksm.c > @@ -679,9 +679,8 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr, bool lock_v > > static bool ksm_compatible(const struct file *file, vm_flags_t vm_flags) > { > - if (vm_flags & (VM_SHARED | VM_MAYSHARE | VM_PFNMAP | > - VM_IO | VM_DONTEXPAND | VM_HUGETLB | > - VM_MIXEDMAP | VM_DROPPABLE)) > + if (vm_flags & (VM_SHARED | VM_MAYSHARE | VM_SPECIAL | > + VM_HUGETLB | VM_DROPPABLE)) > return false; /* just ignore the advice */ > > if (file_is_dax(file))