Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp775566imm; Mon, 9 Jul 2018 10:23:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeb+hXDGJEjeCX5OkRCfLaUB0eR3IP/65A/yDcn8C+R6GCteGyj11TP/PylsP3Ovf5em/V0 X-Received: by 2002:a17:902:1127:: with SMTP id d36-v6mr21644984pla.267.1531156983317; Mon, 09 Jul 2018 10:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531156983; cv=none; d=google.com; s=arc-20160816; b=C6fycO1nCNjGSeLUE2YkiTkJFfwccBLwkts8otxKXgxJIwqiYxnitYyL0rMjigwMk4 0LlDK4drK4z8yoJ5jPxkK8HnBL33+gCjuFmJ+/TTmN+4mxUK4FJxvYcx15txgjqzFNB+ qFfTywR/OVV2OHLA+ReweYkjFBQmcm9RcX88Gt5ChSvZW/8VUDj3QyQiQKk2ccg3n7ok obuIasP8rvKqK11LVMYo+pbmIB0MiL02abBq/9BffL5qwLYg2iZKepVDrLrpccIycrzr m8ncfz29wH+cfoksB+TL7Ab3GsG493/hQ3gRTFTvsVao4i3rsO4MxKLa6620P3ZJYCcp sn3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=cdz6Fc8Y45/mytGQB11dZk7enR4eI9uNICfJV2mGcO0=; b=V/ThpE3FBYXW4726Z92z7RgPmGbh68K0ygF1ASLo1bJ+MDlALYuekaICqoWFoujJUU u2GRRSnjaXyrJB+SxEViCd9gALqwD8Okw3sLLrz8/dpHumc4RPBrpCnIvbF5SMdQUoip XXpqhMao4Ebk8fvfekPDQlBGnpdxA5KtZPgrT27TzThG1CbjUX5XdRJ38PhGeZNC/cJS 75VeJQmTCIW4f4PzZJdmkslufqyLwE1j92GnsgL2KsoH4HP1nSL8i6PFVu/Z1xeYvej+ o3Q0WRhAxFbQiE9zZAOCi/FUV0W1cK+LzCXzusz+SeMBYeSDCLpm9HNmHZISoSKvHt2B 4k8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=g7K2M8Ld; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9-v6si15017075pla.377.2018.07.09.10.22.49; Mon, 09 Jul 2018 10:23:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=g7K2M8Ld; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933835AbeGIRVI (ORCPT + 99 others); Mon, 9 Jul 2018 13:21:08 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:46180 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933479AbeGIRVG (ORCPT ); Mon, 9 Jul 2018 13:21:06 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w69HJIF2075517; Mon, 9 Jul 2018 17:20:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=cdz6Fc8Y45/mytGQB11dZk7enR4eI9uNICfJV2mGcO0=; b=g7K2M8LdvUDHEilqS7tQEr5X1lzLKiBsVyusqjOfxcrTyMbiN4d3MBlPubg7i8XDNwq6 ggQqhnIC1UcdRfHyyPb5Nlyl8EMe64YQQuAC8QLxUP7AHwEq1pOEwDFHYg2YxDRw8aWB VLJixt6OhCKQTdGxbOvo7E12/lIFJHAO5yH+S/d7/lqpp4s+ZvevBk/IGVC1PqdcYsNg GzPnsPc+jd2NMHRett9WVoE4PWMhYHBtyHtpuBrDg6zru7Inh+eTXGGa2KaxnfuZG+he fzdyx8o4m7aXMP441Ji4YvCSNrQp4R5RFFvA0YR2uadwhHbar8IAwsy8Zkv1aLIWJ8QF pA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2k2p75n6nv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 Jul 2018 17:20:38 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w69HKb8p019800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 9 Jul 2018 17:20:37 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w69HKZqe014970; Mon, 9 Jul 2018 17:20:35 GMT Received: from ca-dmjordan1.us.oracle.com (/10.211.9.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 09 Jul 2018 10:20:35 -0700 Date: Mon, 9 Jul 2018 10:20:37 -0700 From: Daniel Jordan To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Andrea Arcangeli , Michal Hocko , Johannes Weiner , Shaohua Li , Hugh Dickins , Minchan Kim , Rik van Riel , Dave Hansen , Naoya Horiguchi , Zi Yan Subject: Re: [PATCH -mm -v4 14/21] mm, cgroup, THP, swap: Support to move swap account for PMD swap mapping Message-ID: <20180709172037.254zyuadep2hj5po@ca-dmjordan1.us.oracle.com> References: <20180622035151.6676-1-ying.huang@intel.com> <20180622035151.6676-15-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180622035151.6676-15-ying.huang@intel.com> User-Agent: NeoMutt/20180323-268-5a959c X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8948 signatures=668705 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807090197 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 22, 2018 at 11:51:44AM +0800, Huang, Ying wrote: > Because there is no way to prevent a huge swap cluster from being > split except when it has SWAP_HAS_CACHE flag set. What about making get_mctgt_type_thp take the cluster lock? That function would be the first lock_cluster user outside of swapfile.c, but it would serialize with split_swap_cluster. > It is possible for > the huge swap cluster to be split and the charge for the swap slots > inside to be changed, after we check the PMD swap mapping and the huge > swap cluster before we commit the charge moving. But the race window > is so small, that we will just ignore the race. Moving the charges is a slow path, so can't we just be correct here and not leak?