From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD64CC33C9E for ; Tue, 7 Jan 2020 02:33:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA77920715 for ; Tue, 7 Jan 2020 02:33:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA77920715 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3B73B8E0011; Mon, 6 Jan 2020 21:33:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 390048E0001; Mon, 6 Jan 2020 21:33:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CC8A8E0011; Mon, 6 Jan 2020 21:33:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id 163948E0001 for ; Mon, 6 Jan 2020 21:33:57 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 9F013181AEF0B for ; Tue, 7 Jan 2020 02:33:56 +0000 (UTC) X-FDA: 76349268072.12.shake71_3f747a8f48421 X-HE-Tag: shake71_3f747a8f48421 X-Filterd-Recvd-Size: 3086 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jan 2020 02:33:55 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jan 2020 18:33:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,404,1571727600"; d="scan'208";a="217587426" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga008.fm.intel.com with ESMTP; 06 Jan 2020 18:33:52 -0800 Date: Tue, 7 Jan 2020 10:33:57 +0800 From: Wei Yang To: David Rientjes Cc: Wei Yang , 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 Message-ID: <20200107023357.GD15341@richard> Reply-To: Wei Yang References: <20200103143407.1089-1-richardw.yang@linux.intel.com> <20200107012624.GB15341@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 06, 2020 at 06:07:29PM -0800, David Rientjes wrote: >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. Ah, thanks David. You are so supportive. -- Wei Yang Help you, Help me