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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30AEFC433FE for ; Wed, 12 Oct 2022 12:15:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FFFF6B0071; Wed, 12 Oct 2022 08:15:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 061B3900002; Wed, 12 Oct 2022 08:15:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF6CD6B0074; Wed, 12 Oct 2022 08:15:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CCDFF6B0071 for ; Wed, 12 Oct 2022 08:15:13 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9B68B1209D4 for ; Wed, 12 Oct 2022 12:15:13 +0000 (UTC) X-FDA: 80012192106.25.D192AAB Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf16.hostedemail.com (Postfix) with ESMTP id 01F3418002C for ; Wed, 12 Oct 2022 12:15:12 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6069C21BF9; Wed, 12 Oct 2022 12:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1665576911; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dCQ2WpDCxrbeT5GJTKPF0LqosNd9RnwLmJ2qJ7436Gs=; b=K/IlkhgrX+2welPakjC0Axi79t2kTcd8AbUB/YTbrcVymSQOLha6U/tbxVDRKT4KIKkyAZ 7Sy+HUDJFDfhIl82HhHEsetW0xrPGq6muCTweAJz5vkYuZvsAKtGgGbGBpLJ0vamfcQ6gE 79FoAkuLBJcGOH2Op8WMHHngsqv5zn4= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 21B9313A5C; Wed, 12 Oct 2022 12:15:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id n/pZB8+vRmM4UgAAMHmgww (envelope-from ); Wed, 12 Oct 2022 12:15:11 +0000 Date: Wed, 12 Oct 2022 14:15:10 +0200 From: Michal Hocko To: Zhongkun He Cc: corbet@lwn.net, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, wuyun.abel@bytedance.com Subject: Re: [External] Re: [RFC] mm: add new syscall pidfd_set_mempolicy() Message-ID: References: <20221010094842.4123037-1-hezhongkun.hzk@bytedance.com> <582cf257-bc0d-c96e-e72e-9164cff4fce1@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665576913; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dCQ2WpDCxrbeT5GJTKPF0LqosNd9RnwLmJ2qJ7436Gs=; b=5JL/bFJX5CxTurkFry15sJhUJD2PkWCCe23K2Z0DraT5Bj3KzkaWLn5uGfHE0qdHQ9JI8f nXWQF57jemWENLkFZRwTA7RBh7jWicfD7QrwHUAeB4Vc0csqECtoT5Y/Ab5norkgVRPhXO l1HioQUMB4Bp0+zFAIz01ox+fS4Y0Rk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="K/Ilkhgr"; spf=pass (imf16.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665576913; a=rsa-sha256; cv=none; b=MO1o5JSNQKXRfNx4JmOnsHQNFatO04Kg/+0R2ErSmpVyu4CT+Txd5bz7ROhlGCXq6A0IG1 W0bg29gopvW41zG+LcMpNEtgeSVi8h+9H50//b4E2Zw0NKzC1kPn5jX5rT6iYVlpSDX7iL OZJuzBtYJXVd75ndNYDw4cPMc6KDY7w= X-Stat-Signature: 7tr463gnzpfbut63gtoei4oe65qcqto4 X-Rspamd-Queue-Id: 01F3418002C Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="K/Ilkhgr"; spf=pass (imf16.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1665576912-397889 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 Wed 12-10-22 19:22:21, Zhongkun He wrote: > > > > Yes, this will require some refactoring and one potential way is to make > > mpol ref counting unconditional. The conditional ref. counting has > > already caused issues in the past and the code is rather hard to follow > > anyway. I am not really sure this optimization is worth it. > > > > Another option would be to block the pidfd side of things on completion > > which would wake it up from the task_work context but I would rather > > explore the ref counting approach first and only if this is proven to be > > too expensive to go with hacks like this. > > Hi Michal > > The counting approach means executing mpol_get/put() when start/finish using > mempolicy,right? We already do that via mpol_{get,put} but there are cases where the reference counting is ignored because it cannot be freed and also mpol_cond_put resp. open coded versions of mpol_needs_cond_ref. -- Michal Hocko SUSE Labs