Re: Attach to shared memory after fork()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 邱宇航(烛远) <yuhang(dot)qyh(at)alibaba-inc(dot)com>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Attach to shared memory after fork()
Date: 2021-04-27 13:51:25
Message-ID: 2616865.1619531485@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"=?UTF-8?B?6YKx5a6H6IiqKOeDm+i/nCk=?=" <yuhang(dot)qyh(at)alibaba-inc(dot)com> writes:
> Fork is an expensive operation[1].

Yeah, it's not hugely cheap.

> So I propose to remove shared buffers from postmaster and shmat them
> after fork.

This proposal seems moderately insane. In the first place, it
introduces failure modes we could do without, and in the second place,
how is it not strictly *more* expensive than what happens now? You
still have to end up with all those TLB entries mapped in the child.

(If your kernel is unable to pass down shared-memory TLBs effectively,
ISTM that's a kernel shortcoming not a Postgres architectural problem.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-04-27 13:53:32 Re: Performance degradation of REFRESH MATERIALIZED VIEW
Previous Message Tomas Vondra 2021-04-27 13:43:07 Re: Performance degradation of REFRESH MATERIALIZED VIEW