Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp22097404ybl; Mon, 6 Jan 2020 18:08:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzuTLwtxKdBbb7DVqaYzKJm1twSJy/iF22fVAWoaUt43KNbrI5myMaNOTrxrWaZNb+XS8qm X-Received: by 2002:a05:6830:15a:: with SMTP id j26mr113430082otp.137.1578362911568; Mon, 06 Jan 2020 18:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578362911; cv=none; d=google.com; s=arc-20160816; b=rvIKxOCo4XF7rGE74U6csXbmvKYwXipSbqPbF8fjowolPrfF7iDL7XEmJB2ia6EEur tuJ1bnm+qk+5zSVgTNhmgoBrvK/BdxJcUkjsjU0IW0MlQ63aVCmb6HIGQHvIFvNhUpLA WlOQy4+mlWQTKe2BvYZ7JGhXFHIqOTpMfCfh1WnGiNICZAqj1pg2ItLk8EL1M/8+kZbJ aZ7QTnwwIK7HTa/RCB2ef99IEyXj+R9yxpkPyyfrO8RQqt0i8/auvD9ZpmaNPPBDIjhR ikUKlY1V3TTQ9CfSKoF7w7oYv6fllcE2gCPRbTDzpUThHsgrQd8TSygGFhKNp3R4zzUk Wubg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=FcqVbuH4BEZl+ciRs0e0B8iPKj0+hshWElohx4nDlP8=; b=iv9zbcvXniVsEAoEM7BwaOowe52cra2hMPDFdw1Nhgm2nMhwNs1Je+o5zinsQ81Hvs aKTCTeGftCntFIS1wShifJ6cAtfHMLZXdz0CfenhHEz9g9RGi+mr34ocRi9XFIQtEl6H L0HSx/Pc30iztAgrv9eQLC8qHPlD23V5uS0XILeil3jJuk9yE865lphDHfU1ubFms5k/ F8o5zTdwNgikOM1k6gLgL/n6GnHq5TpDrJk8YQ65LPA5URXINsodOQHOooWUNrbSWtnz t5jz5kOzor1cLD5/ydo/vM2DCVkBnnu91MviYGEJ0yZjPy7fZfkfj37dneZ3yWeO1DB/ Ku9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sTFeI61t; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l20si37237348otd.292.2020.01.06.18.08.18; Mon, 06 Jan 2020 18:08:31 -0800 (PST) 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=@google.com header.s=20161025 header.b=sTFeI61t; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727488AbgAGCHb (ORCPT + 99 others); Mon, 6 Jan 2020 21:07:31 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42033 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727250AbgAGCHb (ORCPT ); Mon, 6 Jan 2020 21:07:31 -0500 Received: by mail-pl1-f196.google.com with SMTP id p9so22558459plk.9 for ; Mon, 06 Jan 2020 18:07:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=FcqVbuH4BEZl+ciRs0e0B8iPKj0+hshWElohx4nDlP8=; b=sTFeI61tYPfuAIi6zuNSHzccw82y+IFJQZN/FOERtaSSqtpiXv2rOpO1dyPm4suK9d ftLYzVvf4icX0o3N0u/z5HFcxiat1L2XRuge1iX7lbBY2Md2XAs+Vxt04yEGQu7uv2l8 B9lrwHI36DRK0JUm1QxdEBLBDZl4WkM/Ai4x6+Hqh019u9drIfYC7rQPYih72eXUlL7V KOFBxa2toSREPK7LfZYoSs+/8fgvnWy7jTYEu1twlyKcjKroHFNdQjabRMii/TID8Eev FBntvssn6jwCDIMA8zHiVazWzc611aei+IvMD9PvhSF9GrFnfsLNykTivOxhqLapB3+P +P0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=FcqVbuH4BEZl+ciRs0e0B8iPKj0+hshWElohx4nDlP8=; b=o1ynMgGqiK8MG8cSCqLZeIt/Hb3PjSPvInkClEQ+TpumYpK7BdO8flPC8LZpvvb6pT zgkfZaRQig2AtGfRCRrg2b0D1+sMUWqkudTHc6MywsrrzAjMUr977GkCowcZ0ue9q4LP UaZ5cMJjvF7W2Bt9A0jher1iPs6DXIv0Fxpw42llJFA4kMjsryU3pzuLr1Qe4KWQvl/x fw/SpBUQCRfuT/4gJHKjZeIP8qFFRprRNTfp4xi9TcOZ/TrVcT7iVclqovRUPjUyMWts HE4LsGZ54K+oW7XsNEIFQ6TV5cLV6eqa7SKRdD/gq2Elpn789aUsO1/1SwTcShNA+Ovu hjKw== X-Gm-Message-State: APjAAAVio9Y40a8HGGq7KWTEMYUzYiceY3GPhepYaqeeS8p6jGOzb49s QU97aOl+zly5nE6sjORDR6hQDQ== X-Received: by 2002:a17:90a:660b:: with SMTP id l11mr45934270pjj.47.1578362850725; Mon, 06 Jan 2020 18:07:30 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id i3sm78670353pfg.94.2020.01.06.18.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 18:07:29 -0800 (PST) Date: Mon, 6 Jan 2020 18:07:29 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Wei Yang cc: Alexander Duyck , Johannes Weiner , Michal Hocko , vdavydov.dev@gmail.com, Andrew Morton , "Kirill A. Shutemov" , cgroups@vger.kernel.org, linux-mm , LKML , Yang Shi Subject: Re: [RFC PATCH] mm: thp: grab the lock before manipulation defer list In-Reply-To: <20200107012624.GB15341@richard> Message-ID: References: <20200103143407.1089-1-richardw.yang@linux.intel.com> <20200107012624.GB15341@richard> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Jan 2020, Wei Yang wrote: > >One thing you might want to do is pull the "if (compound)" check out > >and place it outside of the spinlock check. It would then simplify > >this signficantly so it is something like > >if (compound) { > > spin_lock(); > > list = page_deferred_list(page); > > if (!list_empty(list)) { > > list_del_init(list); > > from->..split_queue_len--; > > } > > spin_unlock(); > >} > > > >Same for the block below. I would pull the check for compound outside > >of the spinlock call since it is a value that shouldn't change and > >would eliminate an unnecessary lock in the non-compound case. > > This is reasonable, if no objection from others, I would change this in v2. Looks fine to me; I don't see it as a necessary improvement but there's also no reason to object to it. It's definitely a patch that is needed, however, for the simple reason that with the existing code we can manipulate the deferred split queue incorrectly so either way works for me. Feel free to keep my acked-by.