Received: by 10.223.164.221 with SMTP id h29csp2427487wrb; Thu, 2 Nov 2017 10:45:51 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TRkOpPGQ5kFBH6kncRRkBY7iPw6cUX3QnxVAnpl9/HARdf813S4V3QKZ247sEbbWBOjhEP X-Received: by 10.99.115.82 with SMTP id d18mr4443671pgn.142.1509644751009; Thu, 02 Nov 2017 10:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509644750; cv=none; d=google.com; s=arc-20160816; b=hJAQMDJXRRbiDGpqoWzyqlnXHgNu6tm036P6ZAda4skXSGT9F7RQZH0TnFTNeYiTTy 2dC2UzHVaiGRMLWvegcLnYdYiJ0VIzBR8ZsVJbF3DXNnERo0bQBlj3c84K9Cfsz7yNnF 2UarkgTrwupXgV8Op00sCkBYIBXEoGonbJoi2hKHmK/1tdHCHrMSpXSgUi9B9mKoXRVr dD90qRmWralSlScmfr+lkcol1fklzQTCkhqKM8XxAyl9K/C9hx8ccP6CP1DUWmlCD8Tz EClIRKT6XfnYKcBVwIB1VyXc4EehPTil+j0APv4KtRj0uCTze5NTTLhpDge+YLype9C4 wU4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=rnkn0KImKnkkMBj+oyPg3TttnJ+XlhCIunyjD1LqjI8=; b=0FZ1UcFFB8HuM4WIOEnmVMt5EU0KylYf4de1l+/Z3+BqPlqE27bkYFKy6kHPx9Vmrs DR4FrhRQSUdFzSHu0n9H8fCSMAT/YpD+nHTCnUPuyJzuraXunolKI5LwGfA3a77oFy9m 7O6C6x3OvW9Vn3TaoaugYs1toVVJX7s4YB0jPe541qVTFoNvw5zSvdybe2QaHi+hekcd RPRxgdGu25rEOJQ3K3IjjVRfIPgQOyfnpRnFhpSVibCpq52QD3FAk4hqah+rlUe388VG H5paVo8tjhLf6rOsnPqz3ibQqnP+7PdPvhle1/TwYmN+W0uq3jvv+0olHSC6g+YJZaug 6EjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alibaba-inc.com header.s=default header.b=X+1L16xA; 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=alibaba-inc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si2666759pln.821.2017.11.02.10.45.38; Thu, 02 Nov 2017 10:45:50 -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=@alibaba-inc.com header.s=default header.b=X+1L16xA; 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=alibaba-inc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755690AbdKBRpF (ORCPT + 97 others); Thu, 2 Nov 2017 13:45:05 -0400 Received: from out0-205.mail.aliyun.com ([140.205.0.205]:44758 "EHLO out0-205.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752777AbdKBRpE (ORCPT ); Thu, 2 Nov 2017 13:45:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1509644694; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type; bh=rnkn0KImKnkkMBj+oyPg3TttnJ+XlhCIunyjD1LqjI8=; b=X+1L16xAKMifUgFr2msyWQa30FSCx3/NUmJDTwaHOCc5hD0kNtUF7PcryCEDzaWXuWhIZrYbSc9cQT+hlgWE3JBo96T7dgqkvujKMZmq9K6PD2Tc7z/r0+dfh0GfuwXzHyYwTcEF+dj01CMS9TVHNdBVYwdb0bp+xJkUm1dmepQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03275;MF=yang.s@alibaba-inc.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---.9IutLtW_1509644689; Received: from US-143344MP.local(mailfrom:yang.s@alibaba-inc.com ip:121.0.29.196) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Nov 2017 01:44:51 +0800 Subject: Re: [PATCH] mm: use in_atomic() in print_vma_addr() To: Michal Hocko , mingo@redhat.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1509572313-102989-1-git-send-email-yang.s@alibaba-inc.com> <20171102075744.whhxjmqbdkfaxghd@dhcp22.suse.cz> From: "Yang Shi" Message-ID: Date: Fri, 03 Nov 2017 01:44:44 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20171102075744.whhxjmqbdkfaxghd@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/2/17 12:57 AM, Michal Hocko wrote: > On Thu 02-11-17 05:38:33, Yang Shi wrote: >> commit 3e51f3c4004c9b01f66da03214a3e206f5ed627b >> ("sched/preempt: Remove PREEMPT_ACTIVE unmasking off in_atomic()") makes >> in_atomic() just check the preempt count, so it is not necessary to use >> preempt_count() in print_vma_addr() any more. Replace preempt_count() to >> in_atomic() which is a generic API for checking atomic context. > > But why? Is there some general work to get rid of the direct preempt_count > usage outside of the generic API? I may not articulate it in the commit log, I would say "in_atomic" is *preferred* API for checking atomic context instead of preempt_count() which should be used for retrieving the preemption count value. I would say there is not such general elimination work undergoing right now, but if we go through the kernel code, almost everywhere "in_atomic" is used for such use case already, except two places: - print_vma_addr() - debug_smp_processor_id() Both came from Ingo long time ago before commit 3e51f3c4004c9b01f66da03214a3e206f5ed627b ("sched/preempt: Remove PREEMPT_ACTIVE unmasking off in_atomic()"). But, after this commit was merged, I don't see why *not* use in_atomic() to follow the convention. Thanks, Yang > >> Signed-off-by: Yang Shi >> --- >> mm/memory.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/memory.c b/mm/memory.c >> index a728bed..19b684e 100644 >> --- a/mm/memory.c >> +++ b/mm/memory.c >> @@ -4460,7 +4460,7 @@ void print_vma_addr(char *prefix, unsigned long ip) >> * Do not print if we are in atomic >> * contexts (in exception stacks, etc.): >> */ >> - if (preempt_count()) >> + if (in_atomic()) >> return; >> >> down_read(&mm->mmap_sem); >> -- >> 1.8.3.1 > From 1582940311857173892@xxx Thu Nov 02 07:58:39 +0000 2017 X-GM-THRID: 1582901365152158645 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread